0 Replies Latest reply on Dec 8, 2008 9:37 AM by rododendro.ivan

    javax.jmx.Session & JMS XA Connection Factory

    rododendro.ivan

      Hello,
      we have a SLSB who register himself as producer of a topic, in post construct we create Conection, Session & Porducer, and in send() we call session.createObjectMessage():

      @PostConstruct
       public void postConstruct() {
       try {
       connection = connectionFactory.createTopicConnection();
       session = connection.createSession(true, Session.SESSION_TRANSACTED);
       producer = session.createProducer(destination);
       producer.setTimeToLive(messageValidityPeriod * 60000);
       } catch (final JMSException e) {
       logger.error("unable to create JMS producer", e);
       }
       }


      public void send(final Map<String, String> properties, final ProvisioningEvent event) {
       try {
       final ObjectMessage message = session.createObjectMessage();
      
       message.setObject(event);
      
       [...]
      
       producer.send(message);
      
       } catch (final JMSException e) {
       if (logger.isInfoEnabled()) {
       logger.info("JMSException: " + e.getMessage());
       }
       }
       }


      Connetction Factory is JmsXA.

      It worked in JBAS50-CR2 (JBM 1.4.1-CR1 ?), but with JBAS5.0-GA it does not work anymore:

      javax.jms.IllegalStateException: The session is closed


      on calling session.createObjectMessage() in method send().

      Do the session must be created for each method call?

      Thank you
      Ivan