4 Replies Latest reply on Aug 13, 2002 9:26 AM by kennethc

    Simple session bean - invalid transaction id

    ttimm

      Hi a little help please

      I'am using JBoss 3.0.0 and have some problems with sending from a session BEAN to a Message BEAN. The queue is defined as a Queue and my descriptor-file looks like this:


      <enterprise-beans>
      <message-driven>
      <ejb-name>MyTest</ejb-name>
      <destination-jndi-name>queue/env/jms/MyTestQueue</destination-jndi-name>
      <connection-factory-name>java:/XAConnectionFactory</connection-factory-name>
      </message-driven>
      </enterprise-beans>


      I call the session bean from an external client application, but it is only called once.

      The JNDI lookup is done in my ejbCreate and the function envoked by the client looks like the following:
      try
      {
      queueSess = queueCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      String mess = new String("SESSION BEAN CREATED MESSAGE");
      ObjectMessage obMess = queueSess.createObjectMessage(mess);
      qsender = queueSess.createSender(queue);
      qsender.send(obMess);
      }
      catch(Exception ex)
      {
      System.out.println("-- EXCEPTION ERROR : " + ex.toString());
      }

      When I do the qsender.send(queue) I receive the transaction id error.

      Other topics talked about multiple sessions, but since I do it through a Session BEAN, which I only call once, then I don't think thats the problem.

      Any idea of how isolve this??

      regards Troels

        • 1. Re: Simple session bean - invalid transaction id
          ttimm

          Hi

          I have found the answer to my own question.

          Creating a message EJB does not cause JBoss to create the queue specified in the descriptor-file. However, it does create the JNDI name, which makes it possible to lookup the queue. The problems comes when the QueueSender try to send a message (Invalid transaction id).

          Create the Queue in the JBoss descriptor files (JMS-service for 3.0)

          Troels

          • 2. Re: Simple session bean - invalid transaction id
            mathew

            I am encountering a similar exception while trying to configure XA queue connections. I have already tried adding an mbean for my queue in the jbossmq-service.xml and jms-service.xml but without success.

            May I know how you have setup the configurations?

            This the the code I used to send my jms message within a stateless session bean.

            XAQueueConnectionFactory queueFactory = (XAQueueConnectionFactory) ctx.lookup("java:comp/env/jms/qconn");

            Queue que = (Queue) ctx.lookup("queue/q");

            XAQueueConnection queueConn =
            queueFactory.createXAQueueConnection("guest", "guest");
            XAQueueSession session = (XAQueueSession)
            queueConn.createXAQueueSession();

            if (session.getTransacted()) {
            QueueSender sender =
            session.getQueueSession().createSender(que);
            TextMessage msg = session.createTextMessage();
            msg.clearBody();
            msg.setText("update");
            sender.send(msg);
            sender.close();
            }

            Any help will be greatly appreciated. Thanks.

            • 3. Re: Simple session bean - invalid transaction id
              philc

              I have the same problem.
              I get a javax.jms.JMSException: Invalid transaction id. when publishing a message to a XA message topic.


              javax.jms.JMSException: Invalid transaction id.
              at org.jboss.mq.SpyXAResourceManager.addMessage(SpyXAResourceManager.java:71)
              at org.jboss.mq.SpySession.sendMessage(SpySession.java:395)
              at org.jboss.mq.SpyTopicPublisher.internalPublish(SpyTopicPublisher.java:120)
              at org.jboss.mq.SpyTopicPublisher.publish(SpyTopicPublisher.java:68)
              at com.brockhousecooper.tw.ejb.beans.MessengerBean.broadcastBeanFieldChanged(MessengerBean.java:138)

              • 4. Re: Simple session bean - invalid transaction id
                kennethc

                Hello,

                I am also encountering a similar problem. Could you be more specific and outline what changes you made.

                Thanks,

                Ken.