wood burning stoves 2.0
The moose likes JBoss/WildFly and the fly likes how to shutdown a JBOSS client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "how to shutdown a JBOSS client" Watch "how to shutdown a JBOSS client" New topic

how to shutdown a JBOSS client

Jonilie Echavez

Joined: Jun 26, 2009
Posts: 20

I have JBOSS running which i ran using the command:

./run.sh -b uatappl001.opticx.com -c newbieServer

This client is running in port 38080.

How do i properly shutdown this JBOSS?

In my shutdown.sh, i have specifically put the following:

JAVA_OPTS="$JAVA_OPTS -Djava.naming.provider.url=jnp://uatappl001.opticx.com:38080"

But when i run the following command:

./shutdown.sh -S

I get this error:

Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of
these urls: uatappl001.opticx.com:38080 [Root exception is javax.naming.CommunicationException:
Failed to retrieve stub from server uatappl001.opticx.com:38080 [Root exception is java.io.EOFException]]

Am i missing something else in the shutdown script?

Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Have you changed the port for JNDI from 1099 to 38080 (same as the HTTP port) ??

Just use your bind host "jnp://uatappl001.opticx.com:1099" when setting - I normally use the -s flag when shutting down

Regards, Rene Larsen
Dropbox Invite
Jonilie Echavez

Joined: Jun 26, 2009
Posts: 20
Yes, i have changed the port to 38080.

Following your suggestion, i've put :

$ ./shutdown.sh -S -s jnp://uatappl001.opticx.com:38080

But still came up with the same error.

I remembered i have run it while the previous one was still running. Then i killed the process id used in running JBOSS(not a graceful way to shutdown), and i think that left the ports open. So maybe my problem is how to manually close the ports?
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Doing either a CTRL-C or killing the process (except for maybe a "kill -9") will cause JBoss AS to shut down gracefully, which includes closing the ports. For 'kill -9' the OS should be reclaiming the ports.

Run a netstat to determine which ports JBoss AS is using. See: http://community.jboss.org/wiki/DebugBindException
Also, when using shutdown, pass the JNDI port, not the HTTP port (you post is unclear as to whether JNDI or HTTP is using port 38080).

JBoss In Action
Jonilie Echavez

Joined: Jun 26, 2009
Posts: 20
Hi Peter,

Thanks for your reply. It has been quite awhile, and by now the problem has gone away, but i didn't resolved it, and i wanted to clarify on the would-have-been a solution to the problem i had.

Yes, 38080 was HTTP port number instead of JNDI.

But which one are you exactly referring to for JNDI?

Referring back to my server-bindings.xml as below, is it under my Naming config, and if so, then in the example below, do i take the RmiPort 31098 or binding port 31099?

<!-- ********************* jboss-service.xml ****************** -->

<service-config name="jboss:service=Naming"
<delegate-config portName="Port" hostName="BindAddress">
<attribute name="RmiPort">31098</attribute>
<binding port="31099" host="${jboss.bind.address}"/>

There is also a JNDI, but i didn't think it was this one?

<!-- ********************* cluster-service.xml **************** -->

<service-config name="jboss:service=HAJNDI"
<delegate-config portName="Port" hostName="BindAddress">
<attribute name="RmiPort">31101</attribute>
<binding port="31100" host="${jboss.bind.address}"/>

ravikanth reddy
Ranch Hand

Joined: Aug 18, 2009
Posts: 46
Hello Jonilie,

In your case 31099 is the JNP port.

$JBOSS_HOME/bin/shutdown.sh -s jnp://"$PKG_NAME":31099

It will properly stops the server.

Ravikanth Malyala
Vikram Saxena
Ranch Hand

Joined: Dec 16, 2008
Posts: 53
ravikanth reddy wrote:Hello Jonilie,

In your case 31099 is the JNP port.

$JBOSS_HOME/bin/shutdown.sh -s jnp://"$PKG_NAME":31099

It will properly stops the server.

Instead of $PKG_NAME use uatappl001.opticx.com and this will work !!
So the final command should be
$JBOSS_HOME/bin/shutdown.sh -s jnp://uatappl001.opticx.com:31099

SCJP 5 , SCBCD [Prep Started ] , WLS 8.1 Server Admin
Jonilie Echavez

Joined: Jun 26, 2009
Posts: 20
Thank you all! Your comments were helpful and it worked!

$JBOSS_HOME/bin/shutdown.sh -s jnp://uatappl001.opticx.com:31099

where 31099 is the Naming(JNDI) binding port.
It is sorta covered in the JavaRanch Style Guide.
subject: how to shutdown a JBOSS client
It's not a secret anymore!