1 Reply Latest reply on May 9, 2017 9:59 AM by Laura delli Paoli

    [Artemis on Wildfly 10.0] Unable to connect lookup jmx interface from java

    Laura delli Paoli Master


      I'm trying to lookup a Wildfly 10 (local for now but potentially remote) Artemis provider using the following code (and the attached standalone.xml):


      private QueueControl getJmxQueueControl(String queueName, String jmxHostname, Integer jmxPort) throws Exception {
        if (jmxHostname == null || jmxHostname.trim().length() < 1)
        jmxHostname = DEFAULT_JMX_HOST_NAME;
        if (jmxPort == null)
        jmxPort = DEFAULT_JMX_PORT;
        String jmxServiceUrlString = "service:jmx:remoting-jmx://";
        trace.debug("jmx services urlString: " + jmxServiceUrlString);
        // Retrieve the ObjectName of the queue. This is used to identify the
        // server resources to manage
        SimpleString address = new SimpleString(queueName);
        SimpleString name = new SimpleString(queueName);
        ObjectName on = ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name);
        // Create JMX Connector to connect to the server's MBeanServer
        JMXServiceURL serviceURL = new JMXServiceURL(jmxServiceUrlString);
        JMXConnector connector = JMXConnectorFactory.connect(serviceURL, null);//new HashMap());
        // Retrieve the MBeanServerConnection
        MBeanServerConnection mbsc = connector.getMBeanServerConnection();
        // Create a JMSQueueControl proxy to manage the queue on the server
        QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, QueueControl.class, false);
        trace.debug("Successfully got JmxQueueControl on queue " + queueName + " deployed on " + jmxHostname + ":" + jmxPort);
        return queueControl;


      but I get the following error (fails on line 19):


      22:10:13,656 ERROR  (default task-2) Unable to create queue connection: 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)


      Can anyone help me?