2 Replies Latest reply on Feb 2, 2010 4:26 PM by rl

    DestinationManager JMX createQueue FAILS

      Hello Everyone:

       

      I have been browsing the forums to determine if there was a way to create JMS destinations programmatically. Here is the code I put together which is very close to the examples posted.

       

      JMXServiceURL url;

      JMXConnector connector;

      MBeanServerConnection server;

      ObjectName name;

       

       

      url = new JMXServiceURL("service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector");

      connector = JMXConnectorFactory.connect(url, null);

      server = connector.getMBeanServerConnection();

      name = new ObjectName("jboss.mq:service=DestinationManager");

      server.invoke(name, "createQueue", new Object[]{"auto", "auto"}, new String[]{"java.lang.String", "java.lang.String"});      

      connector.close();

       

      When I run this code in a remote VM I get the following exception: ReflectionException with the root cause being:

      Caused by: java.lang.IllegalArgumentException: Unable to find operation createQueue(java.lang.String,java.lang.String)

       

      What is strange is that the JMX-Console reports there are no attributes or operations supported by this MBean.

       

      JBoss:

      [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 34s:742ms

       

      Java VM:

      java version "1.6.0_18"

      Java(TM) SE Runtime Environment (build 1.6.0_18-b07)

      Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

       

      I also twiddled the MBean and its output matched the jmx-console and output from my from program.

       

      Any ideas? Do I need to do something else? Did I miss something?

        • 1. Re: DestinationManager JMX createQueue FAILS
          jaikiran

          rl wrote:

           


          name = new ObjectName("jboss.mq:service=DestinationManager");

           

          JBoss:

          [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 34s:742ms

           

          JBossMQ isn't available in JBoss AS-5. JBoss AS-5 uses JBoss Messaging. So that MBean isn't available in AS-5.

           

          I am not an expert on JBoss Messaging, but i see that there is a MBean jboss.message:service=ServerPeer which has operations like deployQueue/deployTopic which take params like the name and the jndi name of the queue/topic. You might want to give those a try.

          • 2. Re: DestinationManager JMX createQueue FAILS

            Jaikran:

             

            You are 100% correct.

             

            As a side note for those looking to deploy a solution like this remember to do the following:

             

            1. Install RMISecurityManager to allow downloading of remote classes
              1. System.setSecurityManager(new RMISecurityManager());
            2. Add a new permission that allows the VM to open a socket connection to your RMI/JMX server.
              1. Add the following permission: permission java.net.SocketPermission "127.0.0.1", "connect,resolve";
                1. Change the default policy located in your JRE/JDK installation
                2. Add the following command line argument to your VM -D java.security.policy=<your policy name>

             

            Jaikran thank you!