CommunicationException when shutting down JBoss 4.2.2

jbossportrhel5

I have deployed an application using JBoss 4.2.2 on a 64-bit RHEL5 server. Since there are other JBoss servers, I had to change some port configurations so that there would be no conflicts when starting the server. So right now I'm using ports-01 from the sample-bindings.xml file that came in the docs/examples/binding-manager/samples directory. In addition, below is a list of all the files I've edited to reflect the new ports:

  • JBOSS_HOME/servers/default/deploy/jboss-web.deployer/server.xml:
    • Changed Connector port – 8080 to 8180
    • Changed AJP 1.3 Connector port – 8009 to 8109
  • JBOSS_HOME/server/default/deploy/jbossws.beans/META-INF/jboss-beans.xml
    • Changed 8080 to 8180
  • JBOSS_HOME/server/default/conf/jboss-service.xml:
    • Changed 8083 to 8183
    • Changed 1099 to 1299
    • Changed 1098 to 1298
    • Changed 4444 to 4644
    • Changed 4445 to 4645
    • Changed 4446 to 4646
    • Changed 4447 to 4647
  • JBOSS_HOME/server/default/conf/jboss-minimal.xml:
    • Changed 1099 to 1299
    • Changed 1098 to 1298

When I start the server (binding to localhost) everything is fine and I'm able to access the application. But when I try to shutdown the server I get the following error:

Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost [Root exception is javax.naming.CommunicationException
: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.Shutdown.main(Shutdown.java:214)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
… 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
… 5 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.(Socket.java:372)
at java.net.Socket.(Socket.java:273)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
… 5 more

Is there any other file that I need to change the 1099 to 1299, or am I missing some other step?

Best Answer

Shutdown.sh launches a separate java program that sends a JMX request to the jboss server process. It doesn't reference any configuration files to discover the new port, it just assumes the defaults. (how could it? you're not passing it your configuration directory)

So to connect to your jboss server running on the non-default port, you need to run it like so:

shutdown.sh --server=YOURHOST:1299

Also, if you're actually using the sample-binding.xml, i.e., if you uncommented the jboss.system:service=ServiceBindingManager mbean in jboss-service.xml & configured ServerName & StoreURL appropriately, then you shouldn't need to make any other configuration changes for the new ports. That's the point of the binding manager, to centralize all of that work.

Related Topic