1 Reply Latest reply on Mar 28, 2006 12:47 PM by starksm64

    help:what's the difference between "ConnectionFactory" and "

    vincent.yuan

      I meet a problem ,please refer to the following codes

      Object tmp = iniCtx.lookup(TOPIC_CONNECTION_FACTORY_KEY);
      
       String connectStatusTopicName =
       ConfigUtils.getProperties().getProperty("ConnectStatusTopicName",
       "TopicStatus");
       TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
       topic2 = (Topic) iniCtx.lookup(connectStatusTopicName);
       conn = tcf.createTopicConnection();
       session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
       conn.start();
       TopicSubscriber topicSubscriber = session.createDurableSubscriber(
       topic2, "health");
       topicSubscriber.setMessageListener(receiver2);
      

      all is the default configure.
      when TOPIC_CONNECTION_FACTORY_KEY is "ConnectionFactory" ,it's ok.
      but when TOPIC_CONNECTION_FACTORY_KEY is "java:/JmsXA",
      I will meet the following problem caused by "topicSubscriber.setMessageListener(receiver2);"

      javax.jms.IllegalStateException: This method is not applicable inside the application server. See the J2EE spec, e.g. J2EE1.4 Section 6.6
      at org.jboss.resource.adapter.jms.JmsSession.checkStrict(JmsSession.java:531)
      at org.jboss.resource.adapter.jms.JmsMessageConsumer.setMessageListener(JmsMessageConsumer.java:135)
      ......................................
      after I checked the J2ee1.4 spec section6.6, I still don't understand .

      can you help me ???


      thank you .l

      "

        • 1. Re: help:what's the difference between
          starksm64

          The "java:/JmsXA" implementation of the connection factory enforces the "The following methods may only be used by application components
          executing in the application client container:" restrictions from section 6.6 of the j2ee 1.4 spec. None of the methods listed in that section can be used by application components. The message listener would have to be an mdb.