Hello all,

I am facing an issue, which seems to be a regression from my point of view,
but I'd like to know your opinion about this problem... here it is...

We are using ActiveMQ to send a message on queue, which is quite simple:

                                cf = (javax.jms.ConnectionFactory) 
context.lookup(cfName);
                                connection = cf.createConnection(iUser, iPwd);
                                connection.start();
                                
                                javax.jms.Session session = 
connection.createSession(true,
javax.jms.Session.SESSION_TRANSACTED);
                javax.jms.Destination queueOrTopic = (javax.jms.Destination)
context.lookup(iDestinationName);
                
                        javax.jms.MessageProducer sender =
session.createProducer(queueOrTopic);
                        javax.jms.TextMessage message =
session.createTextMessage(iMessage.getBody());

                        sender.send(message);
                        session.commit();

                        connection.close();

It used to work fine with Apache Tomcat (TomEE)/7.0.53 (1.6.0.1), and
ActiveMQ 5.9.0.
But we now use Apache Tomcat (TomEE)/7.0.55 (1.7.1), and ActiveMQ 5.10.0,
and we get the following exception during commit operation: 

javax.jms.IllegalStateException: Not a transacted session
                at
org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:569)
~[activemq-client-5.10.0.jar:5.10.0]
                at
org.apache.activemq.ra.ManagedSessionProxy.commit(ManagedSessionProxy.java:108)
~[activemq-ra-5.10.0.jar:5.10.0]
                at
com.xxx.jms.resource.yyy.ZZZ$Function_SendMessage.executeInternal(ZZZ.java:114)
~[VPLMJMSConnector.jar:6.417.6.15198]

I've compared source code of ManagedConnectionProxy which is used to create
a new ActiveMQSession, and I found in ActiveMQ 5.9.0:
    private ManagedSessionProxy createSessionProxy(boolean transacted, int
acknowledgeMode)
        throws JMSException
    {
        if(!transacted && acknowledgeMode == 0)
        {
            acknowledgeMode = 1;
        }
        ActiveMQSession session =
(ActiveMQSession)getConnection().createSession(transacted, acknowledgeMode);
        ManagedTransactionContext txContext = new
ManagedTransactionContext(managedConnection.getTransactionContext());

        [...]
    }

and in ActiveMQ 5.10.0:
    private ManagedSessionProxy createSessionProxy(boolean transacted, int
acknowledgeMode)
        throws JMSException
    {
        ActiveMQSession session =
(ActiveMQSession)getConnection().createSession(false, 1);
        ManagedTransactionContext txContext = new
ManagedTransactionContext(managedConnection.getTransactionContext());
        [...]
    }

As you can see, the session is now created with hardcoded values: false (not
transacted) and 1 (AUTO_ACKNOWLEDGE mode)
That’s why (I guess) when we commit the transaction, we get the exception.

What do you think about this issue? 
Do we have to change something on our side to make it work with Apache
Tomcat (TomEE)/7.0.55 (1.7.1), and ActiveMQ 5.10.0?
Or do we have to create an incident about this issue?

Don't hesitate if you need more info...
And thanks in advance for your help





--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Not-a-transacted-session-tp4703470.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to