You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Lybarger <ml...@gmail.com> on 2005/05/05 22:30:47 UTC

ant task to start / stop jboss

does anyone have ant tasks (using java task) to start/stop jboss 4.0.0?

i found the following:

http://pgmjsd.buzzword.com/stories/storyReader$143

but the shutdown doesn't seem to recognise my configuration. i'm running on 
port 1199 (since something else is taking my port 1099 on win2k), and jboss 
seems to want to connect to 1099 to shutdown. 

here's my tasks:

<property name="jdk.home" value="d:/j2sdk1.4.2_04" />
<property name="jboss.home" value="${JBOSS_ROOT}" /> <!-- the JBoss server 
installation directory -->
<property name="jboss.host" value="localhost" /> <!-- the JBoss server host 
name -->
<property name="jboss.port" value="1198" /> <!-- the JBoss server naming 
(JNDI) port (default is 1099) -->
<property name="deploy.configuration" value="default" /> <!-- the JBoss 
server configuration name (the directory under JBOSS_HOME/server) -->
<property name="deploy.configuration.dir" value="${JBOSS_ROOT}/server/${
deploy.configuration}/conf" /> <!-- the JBoss server configuration directory 
-->

<target name="jboss.start" description="Start the JBoss server.">
<java dir="${deploy.configuration.dir}" classname="org.jboss.Main" 
fork="true" spawn="true">
<arg line="-c ${deploy.configuration}"/>
<jvmarg value="-Xms32m"/>
<jvmarg value="-Xmx200m"/>
<classpath>
<pathelement path="${jboss.home}/bin/run.jar"/>
<pathelement path="${jdk.home}/lib/tools.jar"/>
</classpath>
</java>
</target>

<target name="jboss.stop" description="Stop the JBoss server.">
<echo>${deploy.configuration.dir}</echo>
<java dir="${deploy.configuration.dir}" classname="org.jboss.Shutdown" 
fork="true">
<arg line="${jboss.host} ${jboss.port}"/>
<classpath>
<pathelement path="${jboss.home}/bin/shutdown.jar"/>
</classpath>
</java>
</target> 

and ant jboss.stop shows:

D:\eQuoteHOWorkspace\autodeploy>ant jboss.stop
Buildfile: build.xml

jboss.stop:
[echo] d:/tools/jboss-4.0.0/server/default/conf
[java] shutdown: unused non-option argument: localhost
[java] shutdown: unused non-option argument: 1198
[java] 16:30:16,518 WARN [NamingContext] Failed to connect to localhost:10
99
[java] javax.naming.CommunicationException: Failed to connect to server loc
alhost:1099 [Root exception is javax.naming.ServiceUnavailableException: 
Failed
to connect to server localhost:1099 [Root exception is 
java.net.ConnectException
: Connection refused: connect]]
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:212)
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
1185)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:51
5)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:50
8)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at org.jboss.Shutdown.main(Shutdown.java:182)
[java] Caused by: javax.naming.ServiceUnavailableException: Failed to conne
ct to server localhost:1099 [Root exception is java.net.ConnectException: 
Connec
tion refused: connect]
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:186)
[java] ... 5 more
[java] Caused by: java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
a:171)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
[java] at java.net.Socket.connect(Socket.java:452)
[java] at java.net.Socket.connect(Socket.java:402)
[java] at java.net.Socket.<init>(Socket.java:309)
[java] at java.net.Socket.<init>(Socket.java:211)
[java] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
tFactory.java:69)
[java] javax.naming.CommunicationException: Could not obtain connection to
any of these urls: localhost:1099 [Root exception is 
javax.naming.CommunicationE
xception: Failed to connect to server localhost:1099 [Root exception is 
javax.na
ming.ServiceUnavailableException: Failed to connect to server localhost:1099 
[Ro
ot exception is java.net.ConnectException: Connection refused: connect]]]
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
1200)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:51
5)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:50
8)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
tFactory.java:62)
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:182)
[java] ... 5 more
[java] at org.jboss.Shutdown.main(Shutdown.java:182)
[java] Caused by: javax.naming.CommunicationException: Failed to connect to
server localhost:1099 [Root exception is 
javax.naming.ServiceUnavailableExcepti
on: Failed to connect to server localhost:1099 [Root exception is 
java.net.Conne
ctException: Connection refused: connect]]
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:212)
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
1185)
[java] ... 4 more
[java] Caused by: javax.naming.ServiceUnavailableException: Failed to conne
ct to server localhost:1099 [Root exception is java.net.ConnectException: 
Connec
tion refused: connect]
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:186)
[java] ... 5 more
[java] Caused by: java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
a:171)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
[java] at java.net.Socket.connect(Socket.java:452)
[java] at java.net.Socket.connect(Socket.java:402)
[java] at java.net.Socket.<init>(Socket.java:309)
[java] at java.net.Socket.<init>(Socket.java:211)
[java] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
tFactory.java:69)
[java] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocke
tFactory.java:62)
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java
:182)
[java] ... 5 more
[java] Exception in thread "main"

[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds
D:\eQuoteHOWorkspace\autodeploy>