2 Replies Latest reply on Dec 7, 2006 10:28 AM by Julien Martin

    jms durableSubscriber problem

    venkata koteswararao Newbie

      Hi iam running Topicpublisher and creating a durableSubcriber(), iam gettign the following error when running the subcriber .. the code was pasted below

      public class TopicPublisherDemo
      {
      public static void main(String args[])
      throws Exception
      {

      String jndi_name =
      "org.jnp.interfaces.NamingContextFactory";

      Properties p = new Properties();

      p.put(Context.INITIAL_CONTEXT_FACTORY,jndi_name);

      p.put(Context.URL_PKG_PREFIXES,
      "org.jboss.naming rg.jnp.interfaces");

      p.put(Context.PROVIDER_URL, "localhost:1100");

      Context ctx = new InitialContext(p);

      Object obj = ctx.lookup("ConnectionFactory");

      TopicConnectionFactory topicFactory =
      ( TopicConnectionFactory ) obj;

      TopicConnection conn =
      topicFactory.createTopicConnection();

      conn.start();

      TopicSession session =
      conn.createTopicSession
      (false, TopicSession.AUTO_ACKNOWLEDGE);

      Topic _topic = (Topic) ctx.lookup("topic/testDurableTopic");


      TopicPublisher publisher =
      session.createPublisher( _topic );

      TextMessage txtMsg =
      session.createTextMessage();

      txtMsg.setText(args[0]);

      publisher.publish(
      txtMsg,
      Message.DEFAULT_DELIVERY_MODE,
      Message.DEFAULT_PRIORITY,
      10000 );

      System.out.println("Message Sent Successfully");

      session.close();
      conn.close();
      }
      }
      ian getting the following error


      Exception in thread "main" javax.jms.JMSSecurityException: Connection not authorized to do durable subscription on topic: testDurableTopic
      at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:135)
      at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:816)
      at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:297)
      at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:166)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:369)
      at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      at java.lang.Thread.run(Thread.java:534)

      can any one give solution to this problem
      i had configured the jndi name in jms-dx xml .