Troubleshooting "JBAS012174" error when JBoss is installed as Windows service

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.2.0+

Issue

  • While increasing the port offset value in standalone.xml file , fail to stop the JBoss installed as windows service with below error in stderr.log file :

    2016-02-16 10:47:51 Commons Daemon procrun stderr initialized
    org.jboss.as.cli.CliInitializationException: Failed to connect to the controller
        at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:284)
            ......
    Caused by: org.jboss.as.cli.CommandLineException: The controller is not available at localhost:9999
            ......
    Caused by: java.io.IOException: java.net.ConnectException: JBAS012174: Could not connect to remote://localhost:9999. The connection failed
            ......
    Caused by: java.net.ConnectException: Connection refused: no further information
            ......
    
  • When we go to services console and stop JBoss service from there, it couldn't be stopped nicely. It was showing "stopping" all the time, we had to kill the java process in the task manager to restart the jboss server.

Resolution

  • Confirm the /controller parameter used when configuring system service matches the management interface and socket binding definition in JBoss configuration file (standalone.xml / domain.xml and host.xml)

    When configuring system service, if not specified, the default configuration for controller is :

    /controller HOST:PORT    The host and port of the management interface. If omitted, the default is localhost:9999.
    

    Change this parameter to match the management interface and socket binding settings in the JBoss configuration file:

    <interfaces>
        <interface name="management">
            <inet-address value="10.10.10.10"/>
        </interface>
    ......
    </interfaces>
    
    <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}"/>
    

    With such configuration above you need to specify /controller as below to install the system service

    service.bat install /startup /controller=10.10.10.10:9999 /config standalone-customized-1.xml 
    
  • If jboss.socket.binding.port-offset is set, confirm actual port number (after offset) is passed in /controller parameter. For example, if jboss.socket.binding.port-offset is set as 300 in standalon.xml, you need to use 10299 (default 9999 + 300) as PORT number to install system service:

    service.bat install /startup /controller=10.10.10.10:10299 /config standalone-customized-2.xml 
    
  • If Windows service has been installed incorrectly, you can uninstall service and then install it again with correct parameter. See document page for more information 2.10.3. Configure JBoss EAP 6 as a Service in Microsoft Windows Server (Zip, Installer)

    service uninstall
    

Root Cause

  • The actual native management binding (HOST:PORT) is defined in JBoss configuration file as interface name="management" and socket-binding name="management-native". By default they use localhost and 9999.

  • When install system service, it is necessary to specify the correct /controller host:port values if management binding has been updated.

  • The error below in the log indicates the CLI command line cannot connect to the management interface when shutting down:

    Could not connect to remote://localhost:9999. The connection failed
    
  • When JBoss stops then the below command is used for shut down of JBoss where it connect to JBoss CLI given in the service.bat file :

    if /I "%IS_DOMAIN%" == "true" (
      set STARTPARAM="/c \"set NOPAUSE=Y ^^^&^^^& domain.bat\""
      set STOPPARAM="/c jboss-cli.bat --controller=%CONTROLLER% --connect %CREDENTIALS% --command=/host=!DC_HOST!:shutdown"
      set LOGPATH=%JBOSS_HOME%\domain\log
    ) else (
      set STARTPARAM="/c \"set NOPAUSE=Y ^^^&^^^& standalone.bat\""
      set STOPPARAM="/c jboss-cli.bat --controller=%CONTROLLER% --connect %CREDENTIALS% --command=:shutdown"
      set LOGPATH=%JBOSS_HOME%\standalone\log
    )
    

Diagnostic Steps

  • Check the management interface binding in standalone.xml (standalone mode) or host.xml (domain mode)

        <interfaces>
            <interface name="management">
                <inet-address value="10.10.10.10"/>
            </interface>
            <interface name="public">
                <inet-address value="xx.xx.xx.xx"/>
            </interface>
            <interface name="unsecure">
                <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
            </interface>
        </interfaces>
    
  • Check the management-native socket binding and jboss.socket.binding.port-offset setting in in standalone.xml (standalone mode) or domain.xml (domain mode)

        <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-group>
    
  • Uninstall system service and re-install it with correct host:port values:

        service uninstall
    
        service.bat install /startup /controller=10.10.10.10:9999 /config standalone-customized-1.xml 
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments