It looks like you're compiling against JMS 2.0, but ActiveMQ only implements JMS 1.1. Here is the 1.1 version of the Connection interface: http://grepcode.com/file/repository.springsource.com/javax.jms/com.springsource.javax.jms/1.1.0/javax/jms/Connection.java#Connection. Notice that the only createSession() method it includes is the two-argument one.
Either use JMS 1.1, or consider using Artemis instead, since it implements JMS 2.0. Tim On Mar 23, 2016 12:57 AM, "THMayr" <[email protected]> wrote: > 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. >
