0 Replies Latest reply on Oct 10, 2007 3:38 PM by Jothipazhani Nagarajan

    How to define SecurityConf when creating a queue dynamically

    Jothipazhani Nagarajan Newbie

      I have the following lines in the jbossmq-destinations-service.xml

      <mbean code="org.jboss.mq.server.jmx.Queue"
       name="jboss.mq.destination:service=Queue,name=EMS1">
       <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
       <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
       <attribute name="SecurityConf">
       <security>
       <role name="mtosiclients" read="true" write="true"/>
       </security>
       </attribute>
      </mbean>


      I wish to remove this entry from the XML and create a queue dynamically...


      So I used the following code:

      ObjectName objName = new ObjectName("jboss.mq:service=DestinationManager");
      MBeanServer server = MBeanServerLocator.locateJBoss();
      DestinationManagerMBean mbean = (DestinationManagerMBean)MBeanServerInvocationHandler.newProxyInstance(server, objName, DestinationManagerMBean.class, false);
      
      mbean.createQueue("EMS1", "queue/EMS1");


      The queue gets created, but when I try to connect to it, I get a no permission error.

      I wish to know whether this approach is correct and how to incorporate the Security conf which we specify in the XML, when we create the queue dynamically.

      -----------------------------------
      I am using jboss 4.0.5GA


      Thanks in advance... for, at least you bothered to read my question :)
      Jo