9 Replies Latest reply on Apr 29, 2016 1:20 AM by guru.1306

    Could not connect to remote http://127.0.0.1:9999 port

    guru.1306

      Hi

       

       

      I am trying to change the log level from info to debug in the standalone.xml configuration file during run time using the ModelControllerClient. But I am unable to connect to the native interface. It fails with the error Could not connect to remote http://127.0.0.1:9999 port. I am using WildFly 9.0.0.Final . If I use the configuration mentioned in this page, WildFly fails to start saying invalid attribute interface. Can someone tell me what's wrong in the confugration?

       

       

      https://docs.jboss.org/author/display/WFLY9/The+native+management+API

       

      Here is the configuration in the standalone.xml file

       

      <native-interface  security-realm="ManagementRealm">

        <socket-binding native="management-native"/>

        </native-interface>

       

       

      Section referring to management-native:

       

      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

              <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:9993}"/>

            <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>

       

       

       

       

       

       

      Here is the code to do that.

       

      client = ModelControllerClient.Factory.create(

               InetAddress.getByName("127.0.0.1"), 9999);  // NOSONAR

           op.get("name").set("level");

           op.get("value").set(stringLevel);

           client.execute(op);

       

       

       

       

       

       

      Thanks

      Guru

        • 1. Re: Could not connect to remote http://127.0.0.1:9999 port
          guru.1306

          Any help here?

          • 2. Re: Could not connect to remote http://127.0.0.1:9999 port
            erhard

            WildFly uses port 9990 for the native interface, not 9999:

            jboss-cli.sh --connect --controller=localhost:9990 "/subsystem=logging/logger=my.test:add(level=DEBUG)"

            That works out of the box.

            • 3. Re: Could not connect to remote http://127.0.0.1:9999 port
              ehugonnet

              You are not specifying which protocol you are using so it falls back to http-remote which is on port 9990.

              ModelControllerClient.Factory.create("remote", InetAddress.getByName("127.0.0.1"), 9999);  // NOSONAR

              • 4. Re: Could not connect to remote http://127.0.0.1:9999 port
                guru.1306

                Is there a particular subsytem responsible for the native interface. I am upgrading from JBOSS 7.1. So I am using the 7.1 standalone.xml file and making the changes accordingly in Wildfly. I may have to add a susbsystem from wildfly standalone.xml.

                 

                 

                Thanks

                Guru

                • 5. Re: Could not connect to remote http://127.0.0.1:9999 port
                  erhard

                  I guess that the confusion comes from the fact that the documentation page The native management API - WildFly 9 - Project Documentation Editor was copied from The native management API - JBoss AS 7.1 - Project Documentation Editor and someone forgot to change port 9999 to 9990, since everything else is the same in WildFly compared to AS7. You don't have to configure anything special to use the native management API (on port 9990).

                       The CLI tool that comes with the application server uses this interface, and user can develop custom clients that use it as well.

                   

                  Side note: I would strongly recommend not to use the standalone.xml from AS7 in WildFly9 but to start with the default configuration and make the changes your application needs. Personally I never edit the standalone.xml directly, but use scripts with "jboss-cli.sh --file=xxx" to do the changes. The commands for the CLI are much more stable than the XML-format and most configurations can be migrated to a newer version with no or only minor changes.

                  • 6. Re: Could not connect to remote http://127.0.0.1:9999 port
                    ehugonnet

                    Hum I disagree. The native management use port 9999 if you configure a native interface. Now native is no longer the default way to connect, you should use the The HTTP management API - WildFly 10 - Project Documentation Editor . It is specified on the native management API that you have to create the interface (it's the first line actually). Maybe this is not enough visible but it is there

                    • 7. Re: Could not connect to remote http://127.0.0.1:9999 port
                      erhard

                      Well as I understand it the native management API is the thing that jboss-cli.sh uses and that can be used with java code. Maybe you can open another interface on port 9999, but I think for WildFly it is simpler to use the existing management port on 9990. But maybe it's better to look at an example. I have the following code with EAP6.2 (AS7):

                       

                      package jbnative;

                      import java.io.IOException;

                      import java.net.InetAddress;

                      import org.jboss.as.controller.client.ModelControllerClient;

                      import org.jboss.dmr.ModelNode;

                       

                      public class ReadVersion {

                        public static void main(String[] args) throws IOException {

                       

                        ModelControllerClient client = ModelControllerClient.Factory

                        .create(InetAddress.getByName("localhost"), 9999);

                        ModelNode op = new ModelNode();

                        op.get("operation").set("read-attribute");

                        op.get("name").set("product-version");

                       

                        ModelNode returnVal = client.execute(op);

                        System.out.println(returnVal.get("result").toString());

                        client.close();

                        }

                      }

                      and the following pom.xml:

                      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                        <modelVersion>4.0.0</modelVersion>

                        <groupId>at.gepardec.demo</groupId>

                        <artifactId>jbnative</artifactId>

                        <version>0.0.1-SNAPSHOT</version>

                        <dependencies>

                          <dependency>

                            <groupId>org.jboss.as</groupId>

                            <artifactId>jboss-as-controller-client</artifactId>

                            <version>7.2.0.Final</version>

                          </dependency>

                        </dependencies>

                      </project>

                      When I start EAP6 with default configuration and run this code I get:

                      "6.2.0.GA"

                      Now I want to migrate this to WildFly (I use EAP-7.0.0.Beta). I change the connect to:

                        ModelControllerClient client = ModelControllerClient.Factory

                        .create(InetAddress.getByName("localhost"), 9990);

                      and the dependency in pom.xml to:

                        <dependency>

                        <groupId>org.wildfly.core</groupId>

                        <artifactId>wildfly-controller-client</artifactId>

                        <version>2.0.3.Final-redhat-1</version>

                        </dependency>

                       

                      I start WildFly with the default configuration, run the code and get:

                      "7.0.0.Beta1"

                      So I just have to change the port and use the current libraries. No fiddling with configuring additional interfaces. And to answer Gurus question, I would suggest he does just that.

                      • 8. Re: Could not connect to remote http://127.0.0.1:9999 port
                        ehugonnet

                        Widlfy use http-remoting as its default remoting protocol where EAP 6/ AS7 used remote (from Jboss Remoting project).

                        You can use the remote protocol on 9999 but that will require some configuration change on WildFly.

                        Gurus has 2 options : change his code or change the configuration. Not knowing his constraints I left it to him to choose

                        • 9. Re: Could not connect to remote http://127.0.0.1:9999 port
                          guru.1306

                          Thanks . The issue is that I used the standalone.xml from 7.1 directly.  Finally I had to edit the standalone.xml manually and it worked .

                           

                          I will use the CLI instead of manually editing it..

                           

                           

                          Thanks

                          Guru