0 Replies Latest reply on May 9, 2017 10:35 AM by Laura delli Paoli

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

    Laura delli Paoli Master

      Hi,

      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:remote+http://192.168.1.65:9990";
        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("jms.queue." + queueName);
        SimpleString name = new SimpleString("jms.queue." + 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:

       

       

      Unable to browse queue: javax.management.InstanceNotFoundException: org.apache.activemq.artemis:module=Core,type=Queue,address="jms.queue.TestQ",name="jms.queue.TestQ"

        at org.jboss.as.jmx.PluggableMBeanServerImpl.findDelegate(PluggableMBeanServerImpl.java:1110)

        at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:717)

        at org.jboss.as.jmx.BlockingNotificationMBeanServer.invoke(BlockingNotificationMBeanServer.java:168)

        at org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:950)

        at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1$1.run(ServerCommon.java:153)

        at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:75)

        at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:70)

        at java.security.AccessController.doPrivileged(Native Method)

        at javax.security.auth.Subject.doAs(Unknown Source)

        at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:92)

        at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor.handleEvent(ServerInterceptorFactory.java:70)

        at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:149)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

       

       

      Can anyone help me?

       

       

      Thanks,

      Laura