0 Replies Latest reply: Jan 7, 2014 5:33 AM by 4c89040d-58b1-4a82-9b9a-b9ed27b12e62 RSS

    How to create JMS/XLA Subscription in Jboss 6.0

    4c89040d-58b1-4a82-9b9a-b9ed27b12e62

      Hi,

       

      I tried to create the Timesten XLA subscription in Jboss, below is the snap shot of the code.

       

      TopicConnectionFactory connectionFactory;

       

       

      Hashtable env = new Hashtable();

      env.put("java.naming.factory.initial", "org.jboss.naming.NamingContextFactory");

      env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

      env.put("java.naming.provider.url", idAliasConfig.getProperty(AliasConstants.PROVIDER_URL));

      env.put(InitialContext.INITIAL_CONTEXT_FACTORY, AliasConstants.XLA_JMS_CONTEXT_FACTORY);

       

      Context initContext = new InitialContext();

       

       

      initContext.addToEnvironment(XlaConstants.CONFIG_FILE_NAME, strJMSXLAFileName);

      Context initContexts = new InitialContext();

      connectionFactory = (TopicConnectionFactory) initContexts.lookup(AliasConstants.XLA_JMS_TOPIC_CONNECTION_FACTORY);

       

      connXlaTopic = connectionFactory.createTopicConnection();

      connXlaTopic.start();

       

      sessionXlaTopic = connXlaTopic.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

       

      XLAMsgListener myListener = new XLAMsgListener();

       

      System.out.println("Creating consumer for topic " + strTopicName);

       

       

      Topic xlaTopic = sessionXlaTopic.createTopic(strTopicName);

       

      TopicSubscriber subscriber = sessionXlaTopic.createDurableSubscriber(xlaTopic,strBookMarkName);

       

      subscriber.setMessageListener(myListener);

       

       

      *********************************************************

      When I tried to deploy the code in Jboss I am getting the following exception.

       

      22:00:55,460 ERROR [stderr] (MSC service thread 1-1) javax.jms.IllegalStateException: Cannot create a subscriber on the durable subscription since it already has subscriber(s)
      22:00:55,461 ERROR [stderr] (MSC service thread 1-1) at org.hornetq.jms.client.HornetQSession.createConsumer(HornetQSession.java:590)
      22:00:55,461 ERROR [stderr] (MSC service thread 1-1) at org.hornetq.jms.client.HornetQSession.createDurableSubscriber(HornetQSession.java:487)
      22:00:55,461 ERROR [stderr] (MSC service thread 1-1) at org.hornetq.jms.client.HornetQSession.createDurableSubscriber(HornetQSession.java:454)


      When I tried to undeploy I am getting below error:


      20:08:54,755 ERROR [stderr] (MSC service thread 1-1) javax.jms.IllegalStateException: Cannot unsubscribe durable subscription IDAliasBookMark since it has active subscribers
      20:08:54,763 ERROR [stderr] (MSC service thread 1-1) at org.hornetq.jms.client.HornetQSession.unsubscribe(HornetQSession.java:785)


      Please help me to resolve the issue ASAP.

      Thanks in Advance.