1 Reply Latest reply on May 23, 2005 5:29 AM by jaikiran

    Invalid transaction id error

    jaikiran

      Hi,
      I am working on JBoss-3.2.3. I have a standalone class which tries writing to a JMS queue. I have been getting the following exception, every time i try sending a message:
      Invalid Transaction Id

      My code is as follows:

      Context ctx = new InitialContext();
       System.out.println("Got context");
      
       QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("java:/JmsXA");
       System.out.println("Got queue connection factory");
      
       Queue queue = (Queue)ctx.lookup("queue/myQueue");
       System.out.println("Got queue:"+queue);
      
       QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
      
       QueueSession queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
      
       QueueSender queueSender = queueSession.createSender(queue);
       Message message = queueSession.createMessage();
       message.setStringProperty("VMID",vmid.toString());
      
       queueSender.send(message);
       System.out.println("Sent message");


      I get the exception at the point :
      queueSender.send();

      I tried out by starting and committing a dummy transaction. But the same error occurs. Below is the code for the same:

      UserTransaction transaction = new DummyUserTransaction(DummyTransactionManager.getInstance());
       transaction.begin();
       try {
      
       Context ctx = new InitialContext();
       System.out.println("Got context");
      
       QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("java:/JmsXA");
       System.out.println("Got queue connection factory");
      
       Queue queue = (Queue)ctx.lookup("queue/Anamika");
       System.out.println("Got queue:"+queue);
      
       QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
      
       QueueSession queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
      
       QueueSender queueSender = queueSession.createSender(queue);
       Message message = queueSession.createMessage();
       message.setStringProperty("VMID",vmid.toString());
      
       queueSender.send(message);
       commitTransaction(transaction);
       System.out.println("Sent message");


      I have seen a lot of posts talking about the same error, but havent found a solution. Is there any solution for the same?

      Thank you.



        • 1. Re: Invalid transaction id error
          jaikiran

          Hi,
          Can anyone tell me whether this doesnt work in JBoss-3.2.3? I have been trying to find a solution for this since a long time now.

          I also, tried out by removing the creation of a transaction. Even then i got the same exception.

          Hopefully, will get a reply this time

          Thank you