JBoss Error: 'java.net.ConnectException: Connection refused'

Overview

When deploying a new instance, the JBoss connection is refused and does not launch. Running the script conntest.sh, the following error is thrown:

Failed to connect to Connect application server; nested exception is:
java.net.ConnectException: Connection refused
There was a problem connecting to the application server.
Please verify your connection information.

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

Sometimes when a user is deploying a new instance, they just copy everything from another instance without changing the port number.

Resolution

Identify the port value depending on your JBoss version as indicated below and change them manually to fix the issue:

  • Follow these steps for JBoss version 6 and above:
    1. Locate the standalone.XML file in the location: $JBOSS_HOME/standalone/configuration/standalone.xml.
    2. Open the file and search for the code: <socket-binding-group>
      • The <socket-binding-group/> element contains all the details of the running process and the ports they run on. The code section looks like this:
        <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
        <socket-binding name="ajp" port="8009"/>
        <socket-binding name="http" port="8080"/>
        <socket-binding name="https" port="8443"/>
        <socket-binding name="remoting" port="4447"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <outbound-socket-binding name="mail-smtp">
        <remote-destination host="localhost" port="25"/>
        </outbound-socket-binding>>
        </socket-binding-group>
    3. Update the <port> values here with the correct values manually.
    4. Save and close the file.
    5. Restart the machine.

  • Follow these steps for versions older than JBoss version 6:
    1. Locate jboss-service.xml in the location: <jboss>/server/default/conf/jboss-service.xml.  
    2. Open the file and search for the following code section which describes the port configuration. 
        <mbean code="org.jboss.services.binding.ServiceBindingManager" name="jboss.system:service=ServiceBindingManager">
          <attribute name="ServerName">ports-01</attribute>
          <attribute name="StoreURL">${jboss.home.url}/server/default/conf/bindings.xml</attribute>
          <attribute name="StoreFactoryClassName">
            org.jboss.services.binding.XMLServicesStoreFactory
          </attribute>
        </mbean>
    3. Identify the path and file JBoss is referring to for ports configuration.
      In this example above, JBoss is referring to a "ports-01" configuration in the /server/default/conf/bindings.xml file.
    4. Update the <port> value with the correct value manually in bindings.xml.
    5. Save and close the file.
    6. Restart the machine.

Confirmation 

JBoss should start running after the port number is fixed.

Related Articles

Comments

0 comments

Please sign in to leave a comment.