activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From THMayr <>
Subject Re: Exception in createSesson() inside an EJB user transaction
Date Wed, 23 Mar 2016 06:22:59 GMT
Hi Tim,

here the complete list of imports:

import javax.ejb.MessageDrivenContext;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;

And here the relevant lines of code in /onMessage()/:

initialContext           = new javax.naming.InitialContext();
environmentContext = (Context) initialContext.lookup ("java:comp/env");
connectionFactory    = (ConnectionFactory)
ejbContext              = (MessageDrivenContext)
userTransaction = ejbContext.getUserTransaction ();
userTransaction.setTransactionTimeout (60000);
userTransaction.begin ();
connection = connectionFactory.createConnection ();
connection.start ();
session = connection.createSession ();  // <- This is line 212

The last line is line 212. When I replace this line with the following, the
exception doesn't occur:

session = connection.createSession (false, Session.AUTO_ACKNOWLEDGE);

Hope this helps


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message