Skip to main content

Invoking asadmin start-domain from ANT

3 replies [Last post]
spark101
Offline
Joined: 2006-06-13

All,

I'm having a little problem invoking the start-domain command from ANT. When I do, the start-domain command doesn't seem to return and my ANT script hangs; none of the echo messages in my target are printed to the console. Could anyone help me out? I'm certain it's something obvious, but I just can't see it. I'm using Java 1.5.0_06 and ANT 1.6.5. The ANT target is as follows:

Thanks,

Si

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
km105526
Offline
Joined: 2005-04-04

> > ish" description="Starts the Glassfish server">
> > > ec executable="${glassfish.home}/bin/asadmin.bat"
> timeout="60000" errorproperty="start.javaee.error"
> resultproperty="start.javaee.result"
> vaee.result" outputproperty="start.javaee.output"

Can you set "spawn" attribute on "exec" task to "true". For
a working version, please see:

http://fisheye5.cenqua.com/browse/glassfish/appserv-tests/config/run.xml...

search for startDomainWindows

Thanks,
Kedar

ss141213
Offline
Joined: 2005-03-30

Use vmlauncher="false" as shown below:
[code]
vmlauncher="false">
[/code]
Secondly, if you want your build.xml to work on Unix systems, then don't specify the executable as asadmin.bat; use only asadmin.

Sahoo

janey
Offline
Joined: 2005-05-30

Hi Si,

I have seen this problem before when invoking ant on a DOS batch script. Seems like ant is not returning the control after executing a batch script. Even adding "cmd ... /c" does not help.
The workaround is to use the AppServer ant tasks. In your build.xml file, you need to add the following taskdef:

Instead of using: , you need to use the target:

You'll need to add the following jars in your classpath before starting ant:
%AS_INSTALL%\lib\derby.jar";"%AS_INSTALL%\lib";"%AS_INSTALL%\lib\appserv-se.jar";"%AS_INS
TALL%\lib\appserv-rt.jar";"%AS_INSTALL%\lib\appserv-ext.jar";"%AS_INSTALL%\lib\j
2ee.jar";"%AS_INSTALL%\lib\admin-cli.jar";"%AS_INSTALL%\lib\appserv-admin.jar";"
%AS_INSTALL%\lib\commons-launcher.jar";"%AS_INSTALL%\lib\jaxr-impl.jar";"%AS_INS
TALL%\lib\relaxngDatatype.jar";"%AS_INSTALL%\lib\xsdlib.jar";"%AS_ANT_LIB%\ant.jar

You can also use /asant to invoke your build.xml and you don't need to set the classpath or taskdef.

See: http://docs.sun.com/app/docs/doc/819-3659/6n5s6m57s?q=asant&a=view
to read more about asant.

HTH,
Jane