2 Replies Latest reply on Feb 16, 2003 8:48 PM by Adrian Brock

    JMS/Transactions

    Greg Heidel Newbie

      I am using JMS/JBoss (3.0.4) to do some transactional logging. The following code works fine:

      InitialContext initialContext = new InitialContext();
      qcf = (QueueConnectionFactory) initialContext.lookup("java:/XAConnectionFactory");
      queue = (Queue) initialContext.lookup("queue/TranLog");
      ...
      m_connection = m_factory.createQueueConnection();
      m_session = m_connection.createQueueSession( true, Session.AUTO_ACKNOWLEDGE );
      m_sender = m_session.createSender( m_queue );
      ...
      m_sender.send( message );
      m_session.commit();


      However my original code:

      InitialContext initialContext = new InitialContext();
      qcf = (QueueConnectionFactory) initialContext.lookup("java:/JmsXA");
      queue = (Queue) initialContext.lookup("queue/TranLog");
      ...
      m_connection = m_factory.createQueueConnection();
      m_session = m_connection.createQueueSession( true, Session.AUTO_ACKNOWLEDGE );
      m_sender = m_session.createSender( m_queue );
      ...
      m_sender.send( message );

      produces an error due to a NULL transaction id i.e. invalid transaction id.

      I was wondering why my original code didn't work???

      Thanks for all help.