Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "how to shutdown a JBOSS client" Watch "how to shutdown a JBOSS client" New topic
Author

how to shutdown a JBOSS client

Jonilie Echavez
Greenhorn

Joined: Jun 26, 2009
Posts: 20
Hi,

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
Greenhorn

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
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

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
Greenhorn

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"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port" hostName="BindAddress">
<attribute name="RmiPort">31098</attribute>
</delegate-config>
<binding port="31099" host="${jboss.bind.address}"/>
</service-config>

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

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

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

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


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

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to shutdown a JBOSS client