Deploying topics via JMX vs. jboss-service.xml
jpace Jan 3, 2005 8:06 AMI am using the default configuration with JBoss 3.2.6. I can deploy a topic using the following XML:
<mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=SampleTopic"> <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="durpublisher" read="true" write="true" create="true"/> </security> </attribute> </mbean>
and then I can create a Durable Topic Subscription using the following code:
InitialContext iniCtx = new InitialContext(); TopicConnectionFactory tcf = (TopicConnectionFactory) iniCtx.lookup("ConnectionFactory"); TopicConnection conn = tcf.createTopicConnection("john", "needle"); Topic topic = (Topic) iniCtx.lookup( "topic/SampleTopic" ); TopicSession session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE); conn.start(); TopicSubscriber recv = session.createDurableSubscriber(topic, "SampleSubscriber");
However, if I instead create the topic at runtime, via the JMX Console, I get an exception. I use the createTopic method in the DestinationManager MBean. After the topic has been created, I set the SecurityManager and SecurityConf attributes in the MBean. I set SecurityManager to:
jboss.mq:service=SecurityManager
and I set the SecurityConf attribute to:
<security><role name="durpublisher" read="true" write="true" create="true"/></security>
When I try to subscribe to the topic using the code above, I get the following exception:
15:37:46,781 INFO [STDOUT] javax.jms.JMSSecurityException: Connection not authorized to do durable subscription on topic: SampleTopic
15:37:46,781 INFO [STDOUT] at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:135)
15:37:46,782 INFO [STDOUT] at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:816)
15:37:46,782 INFO [STDOUT] at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:297)
15:37:46,782 INFO [STDOUT] at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:160)
15:37:46,798 INFO [STDOUT] at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:358)
15:37:46,798 INFO [STDOUT] at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
15:37:46,799 INFO [STDOUT] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
15:37:46,799 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
Any idea what steps I'm missing when I create the topic via JMX instead of deploying it via XML?