activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From THMayr <Thomas.M...@adesso.de>
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)
environmentContext.lookup("jms/ConnectionFactory");
ejbContext              = (MessageDrivenContext)
initialContext.lookup("java:comp/EJBContext");
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

Thomas




--
View this message in context: http://activemq.2283324.n4.nabble.com/Exception-in-createSesson-inside-an-EJB-user-transaction-tp4709452p4709897.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message