JBoss Shutting Down Error: 'javax.naming.CommunicationException: Could not obtain connection to any of these urls'

Overview

The user receives an error similar to the following when trying to shut down JBoss.

Exception in thread "main" javax.naming.CommunicationException:
Could not obtain connection to any of these urls:
localhost:1099 [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:10016
[Root exception is java.net.ConnectException: Connection refused]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1242)

Important Note: If you are unsure about securely performing the steps mentioned in this article, always make a backup before making any changes or reach out to support for more help.

Root Cause

The default ports for JBoss have been changed and the shutdown.sh script is looking at the incorrect port to issue a shutdown command to JBoss.

Resolution

Follow these steps to resolve this issue:

  1. Find the port number in the file sample-bindings.xml located under the $JBOSS_HOME/docs/examples/binding-manager directory. 

    • Here is an example of the block of XML with the port number. The correct port is normally the second IP or '1961' in this block example.
      <server name="ports-01">
      <!-- ********************* jboss-service.xml ****************** -->
      <service-config name="jboss:service=Naming" delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
      <delegate-config portName="Port" hostName="BindAddress">
      <attribute name="RmiPort">1960</attribute>
      </delegate-config>
      <binding port="1961" host="${jboss.bind.address}"/>
      </service-config>
  2. Use the following syntax to shutdown JBoss with the correct port number:
    shutdown.sh -s :[port number]

Confirmation 

JBoss should shut down properly after fixing the port number value in the shutdown.sh script.

Related Articles

Comments

2 comments

  • Avatar
    RAJ MUSHAM

    javax.naming.CommunicationException: Could not obtain connection to any o
    f these urls: 10.10.19.65:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exce
    ption is javax.naming.CommunicationException: Failed to connect to server /10.10.19.65:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /10.10.19.65:1099 [
    Root exception is java.net.ConnectException: Connection refused: connect]]]

    0
    Comment actions Permalink
  • Avatar
    RAJ MUSHAM

    Getting this error while migrating jboss 5.0 to jboss EAP 7.2 server, anybody know the solution please guide.

    0
    Comment actions Permalink

Please sign in to leave a comment.