3 Replies Latest reply on Jul 9, 2016 5:41 AM by Wolfgang Mayer

    Wildfly10 client connection to JMX subsystem

    Robert Benkovitz Newbie

      Hello:

       

      I am attempting to get a connection to the JMX sysbsytem.  The most recent document I've found on how to achieve this is located here:

       

      https://docs.jboss.org/author/display/WFLY8/JMX+subsystem+configuration

       

      However, this approach doesn't seem to work.  First, I am getting warnings about http-remoting-jmx service being deprecated, and to use remote+http.  However, attempting to use that service (not sure if I formatted it correctly) yields a "service not found" error.  Using the older one, I keep getting this error:

       

      Exception in thread "main" java.io.IOException: Operation failed with status WAITING

        at org.jboss.remotingjmx.RemotingConnector.internalRemotingConnect(RemotingConnector.java:247)

        at org.jboss.remotingjmx.RemotingConnector.internalConnect(RemotingConnector.java:158)

        at org.jboss.remotingjmx.RemotingConnector.connect(RemotingConnector.java:105)

        at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)

        at com.silver.bpc.common.batch.CheckQueue.numMessages(CheckQueue.java:95)

        at com.silver.bpc.common.batch.CheckQueue.main(CheckQueue.java:141)

       

      Is there an updated document on how to get this connection for WildFly 10?  Also, what port should I be attempting to connect to?  I've tried 8080, 9990, and 9999, all to no avail.

       

      BTW, I'm basically using "full-ha" profile in the domain.xml configuration file provided with WildFly 10.

       

      Thanks for any help you can give.

        • 1. Re: Wildfly10 client connection to JMX subsystem
          Wolfgang Mayer Master

          I think there is nothing special to WildFly regarding JMX. If you check the Oracle documentation Creating a Custom JMX Client (The Java™ Tutorials > Java Management Extensions (JMX) > Remote Managem…

          you will also find a few simple examples.

          You should take the WildFly management port. So the URL should look like

          service:jmx:remote+http://localhost:9990

          But you should also make sure that the WildFly jars (from $JBOSS_HOME/modules/system/layers/base/) are included in the Java classpath.

          • 2. Re: Wildfly10 client connection to JMX subsystem
            Robert Benkovitz Newbie

            Thank you for the reply Wolfgang - much appreciated.

             

            I've tried to connect using the URL you mentioned above, but I keep getting an "Unknown service name" exception as below:

             

             

            serviceURL = service:jmx:remote+http://172.31.62.219:9990


            Exception in thread "main" java.io.IOException: Unknown service name

              at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:432)

              at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:46)

              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

              at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:199)

              at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:113)

              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

              at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)

              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

              at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)

              at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)

              at org.xnio.nio.WorkerThread.run(WorkerThread.java:559)


            You mention the "WildFly jars" - which ones?  I'm currently including the $JBOSS_HOME/bin/client/jboss-client.jar file, but nothing else specific to jmx - should I be including other jars?


            Thanks again.

            • 3. Re: Wildfly10 client connection to JMX subsystem
              Wolfgang Mayer Master

              This script is working in my environment.

               

              if [ ${#JBOSS_VERSION} -eq 0 ]

              then JBOSS_VERSION='WildFly'

              fi

               

              if [ $JBOSS_VERSION = 'AS7' ]

              then

               

              # JBoss AS7

                echo 'using AS7 configuration'

                JBOSS_MODULEPATH=$JBOSS_HOME/modules

                MODULES="org/jboss/remoting3/remoting-jmx org/jboss/remoting3 org/jboss/logging org/jboss/xnio org/jboss/xnio/nio org/jboss/sasl org/jboss/marshalling org/jboss/marshalling/river org/jboss/as/cli org/jboss/staxmapper org/jboss/as/protocol org/jboss/dmr org/jboss/as/controller-client org/jboss/threads org/jboss/as/controller"

               

                elif [ $JBOSS_VERSION = 'EAP6' ]

                  then

                    # EAP6

                    echo 'using EAP6 configuration'

                   JBOSS_MODULEPATH=$JBOSS_HOME/modules/system/layers/base/

                   MODULES="org/jboss/remoting-jmx org/jboss/remoting3 org/jboss/logging org/jboss/xnio org/jboss/xnio/nio org/jboss/sasl org/jboss/marshalling org/jboss/marshalling/river org/jboss/as/cli org/jboss/staxmapper org/jboss/as/protocol org/jboss/dmr org/jboss/as/controller-client org/jboss/threads org/jboss/as/security"

               

                 else

                   # WildFly

                   echo 'using WildFly configuration'

                   JBOSS_MODULEPATH=$JBOSS_HOME/modules/system/layers/base/

                   MODULES="org/jboss/remoting-jmx org/jboss/remoting org/jboss/logging org/jboss/xnio org/jboss/xnio/nio org/jboss/sasl org/jboss/marshalling org/jboss/marshalling/river org/jboss/as/cli org/jboss/staxmapper org/jboss/as/protocol org/jboss/dmr org/jboss/as/controller-client org/jboss/threads"

                 fi

               

                for MODULE in $MODULES

                 do

                  for JAR in `cd "$JBOSS_MODULEPATH/$MODULE/main/" && ls -1 *.jar`

                   do

                    CLASSPATH="$CLASSPATH:$JBOSS_MODULEPATH/$MODULE/main/$JAR"

                   done

                 done

               

                 CLASSPATH=$CLASSPATH:${myClassPath}

               

                 java -cp $CLASSPATH ${ClassFile} "$@"