3 Replies Latest reply on Mar 20, 2012 5:46 AM by qtm

    remote jms client for 7.1 hangs

    qtm Newbie

      Hello,

       

      I'm using Jboss 7.1 Final and I'm trying to get all the queue names from a remote client.

       

              String urlString = "service:jmx:remoting-jmx://[my_ip]:9999"; 

              JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(urlString), new HashMap<String, String>());

       

              try{

                  MBeanServerConnection mbsc = connector.getMBeanServerConnection();

                  ObjectName on = ObjectNameBuilder.DEFAULT.getJMSServerObjectName();

                  JMSServerControl serverControl = (JMSServerControl)MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSServerControl.class, false);

                  String[] queueNames = serverControl.getQueueNames();

                  for (String qn : queueNames){

                        System.out.println(qn);

                  }   

              } catch (Throwable e){

                  System.out.println("Exception : " + e);

              }finally{

                  connector.close();   

                  System.out.println("The end");

              }      

       

        This code is executed in the main method of a class in a standard java eclipse project with the client-all jar in the classpath. It prints the correct list and "The end" is printed too, no exceptions are thrown,  but the application doesn't close. I have to manually terminate it. Has anyone any idea why?

       

      Also, I would like to get all the queues names by using  the remoting port(4447). Is this possible?

       

      I'm running the default standalone-full.xml configuration with just one change :

         <hornetq-server>

        [....]

              <jmx-management-enabled>true</jmx-management-enabled>

        [...]

        </hornetq-server>

      I'm starting jboss with:

      ./standalone.sh --server-config=standalone-full.xml -bmanagement=[my_ip]

       

      Thank you

        • 1. Re: remote jms client for 7.1 hangs
          Justin Bertram Master

          I'm not sure why your client is hanging.  A thread dump would probably be helpful here.

           

          Regarding port 4447, you can't get everything you need through it, but you can use 4447 to perform a JNDI lookup to get a JMS connection factory and then use the HornetQ management functionality to list the names of the queues.  For example:

           

             Message m = session.createMessage();

             JMSManagementHelper.putAttribute(m, resourceName, attributeName);

             Message reply = requestor.request(m);

             Object[] result = (Object[]) JMSManagementHelper.getResult(reply);  // array of untyped Strings

           

          You can read more about this in the HornetQ docs.

          1 of 1 people found this helpful
          • 2. Re: remote jms client for 7.1 hangs
            qtm Newbie

            Hi,

             

            Thanks for answering, I've retested it and I've discovered that it hangs only for 1min or so, then it closes. I guess some timeout expires. Here's the thread dump:

             

            Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.6-b01 mixed mode):

             

            "DestroyJavaVM" prio=6 tid=0x000000000002b000 nid=0x16a4 waiting on condition [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "pool-1-thread-1" prio=6 tid=0x0000000006dbe800 nid=0x141c waiting on condition [0x000000000884f000]

               java.lang.Thread.State: TIMED_WAITING (parking)

                    at sun.misc.Unsafe.park(Native Method)

                    - parking to wait for  <0x00000000eac1f858> (a java.util.concurrent.SynchronousQueue$TransferStack)

                    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:196)

                    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:424)

                    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:323)

                    at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:874)

                    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:945)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

                    at java.lang.Thread.run(Thread.java:662)

             

            "Low Memory Detector" daemon prio=6 tid=0x0000000006524800 nid=0x1610 runnable [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "C2 CompilerThread1" daemon prio=10 tid=0x000000000651f000 nid=0x1194 waiting on condition [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "C2 CompilerThread0" daemon prio=10 tid=0x000000000650c000 nid=0x140c waiting on condition [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "Attach Listener" daemon prio=10 tid=0x0000000006509000 nid=0x1474 waiting on condition [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "Signal Dispatcher" daemon prio=10 tid=0x0000000006504000 nid=0xf14 runnable [0x0000000000000000]

               java.lang.Thread.State: RUNNABLE

             

            "Finalizer" daemon prio=8 tid=0x00000000002cb800 nid=0x15b8 in Object.wait() [0x00000000064af000]

               java.lang.Thread.State: WAITING (on object monitor)

                    at java.lang.Object.wait(Native Method)

                    - waiting on <0x00000000ebac8518> (a java.lang.ref.ReferenceQueue$Lock)

                    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)

                    - locked <0x00000000ebac8518> (a java.lang.ref.ReferenceQueue$Lock)

                    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)

                    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

             

            "Reference Handler" daemon prio=10 tid=0x00000000002c8000 nid=0x166c in Object.wait() [0x00000000063af000]

               java.lang.Thread.State: WAITING (on object monitor)

                    at java.lang.Object.wait(Native Method)

                    - waiting on <0x00000000ebac80e0> (a java.lang.ref.Reference$Lock)

                    at java.lang.Object.wait(Object.java:485)

                    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)

                    - locked <0x00000000ebac80e0> (a java.lang.ref.Reference$Lock)

             

            "VM Thread" prio=10 tid=0x00000000002c0000 nid=0xfe8 runnable

             

            "GC task thread#0 (ParallelGC)" prio=6 tid=0x0000000000216000 nid=0xbc0 runnable

             

            "GC task thread#1 (ParallelGC)" prio=6 tid=0x0000000000218000 nid=0xc50 runnable

             

            "GC task thread#2 (ParallelGC)" prio=6 tid=0x000000000021b000 nid=0x1184 runnable

             

            "GC task thread#3 (ParallelGC)" prio=6 tid=0x000000000021c800 nid=0xab0 runnable

             

            "VM Periodic Task Thread" prio=10 tid=0x000000000653d000 nid=0xd8c waiting on condition

             

            JNI global references: 946

            • 3. Re: remote jms client for 7.1 hangs
              qtm Newbie

              Hi,

               

              I've found the cause : https://issues.jboss.org/browse/REMJMX-34  + https://community.jboss.org/message/719243#719243

               

              This issue is solved in 7.1.1. Anyway, using the JMSManagementHelper is nicer :

               

                         Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management");  

                          QueueRequestor requestor = new QueueRequestor(session, managementQueue);

                          JMSManagementHelper.putAttribute(m, ResourceNames.JMS_SERVER, "QueueNames");

                          Message reply = requestor.request(m);

                          Object[] result = (Object[]) JMSManagementHelper.getResult(reply); 

                          System.out.println(result.length);

                          for (Object obj : result){

                              System.out.println((String)obj);

                          }