Issue

Following our documentation to create a Windows Service, you may notice the service starts your JBoss instance as expected, but fails to shut down the instance. The service shows as "Stopping" and the only option is to kill the Java.exe process.

The following exception is returned in your log file:

Failed to connect to the controller

org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:284)

org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:250)

org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

java.lang.reflect.Method.invoke(Unknown Source)

org.jboss.modules.Module.run(Module.java:292)

org.jboss.modules.Main.main(Main.java:455)

localhost:9999

at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:969)

at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:808)

at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:784)

at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:282)

... 8 more

java.io.IOException: java.net.ConnectException: JBAS012174: Could not connect to remote://localhost:9999. The connection failed

Solution

The error indicates JBoss is unable to connect to the Management Interface when shutting down:

java.io.IOException: java.net.ConnectException: JBAS012174: Could not connect to remote://localhost:9999. The connection failed

This interface is configured in the "Standalone.xml" (Standalone) or "Domain.xml" (Cluster):

<interfaces>

    <interface name="management">           

        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>

    </interface>

    <interface name="public">

        <inet-address value="${jboss.bind.address.management:x.x.x.x}"/>

    </interface>

     <interface name="unsecure">

        <inet-address value="${jboss.bind.address.unsecure:127.0.0.0}"/>   

    </interface>

<interfaces/>

In addition, the management-native socket is configured in the following section:

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

Should you use the pre-configured JBoss instance, the above sections need to be configured manually. The configuration steps are available from the following link.

An alternative is to re-install the service using the following commands:

service uninstall

service.bat install /startup /controller=192.168.0.1:9999 /config standalonecustomized‐1.xml

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy