4 Replies Latest reply on Aug 23, 2012 7:48 AM by Bhaskar Bhardwaj

    problem in getting ObjectName

    Bhaskar Bhardwaj Newbie

      Hi ,

      I am trying for getting the objectname by using following code:

       

       

      ObjectName objectName=new ObjectName("jboss.messaging.destination:name=DLQ,service=Queue")

       

      but i got following error:

       

      Exception in thread "main"

       

      javax.management.InstanceNotFoundException :  jboss.messaging.destination:name=DLQ,service=Queue is not registered

       

      NOTE:

      My env is :

          jboss 6.1.0 final

           eclipse:Version: Indigo Service Release 1

       

      Bhaskar

       

       

       

       

       

       

       

        • 1. Re: problem in getting ObjectName
          Bhaskar Bhardwaj Newbie

          Please reply , it is very important!

          • 2. Re: problem in getting ObjectName
            Yuriy Grechanyi Newbie

            Hi Bhaskar,

             

            jboss 6.1.0 has not jboss.messanging domain at all

            you can use org.hornetq:module=JMS,name="DLQ",type=Queue instead

             

            also you can check all needed mbeans through jmx console: http://<jboss_host>:<jboss_port>/jmx-console

            (default password stored in: <jboss_serverhome>/conf/props/jmx-console-users.properties)

             

            good luck!

            1 of 1 people found this helpful
            • 3. Re: problem in getting ObjectName
              Bhaskar Bhardwaj Newbie

              Hi Mr Yuriy,

               

              I followed the suggestion given by you , but still i am facing the same problem. Do we need to register "ObjectName" before making the instance??

              • 4. Re: problem in getting ObjectName
                Bhaskar Bhardwaj Newbie

                we can not directly get the objecname by using :org.hornetq:module=JMS,name="DLQ",type=Queue.

                 

                     Thus, for getting  objectname, i iterated the set of objectnames  through  following method:

                 

                         

                       public ObjectName getObjectNames()

                        {

                         

                           ObjectName serviceRef = new ObjectName("*.*:*");

                           Set<ObjectName> mbeans = server.queryNames(serviceRef, null);

                           for(ObjectName on : mbeans)

                           {

                               if(on.toString.trim.contains("JMS") && on.toString.trim.contains("DLQ")

                                    serviceRef = on;

                          }

                          return serviceRef;

                      }

                 

                Thanks!!