Ported locally transacted JMS sessions do not work in Liberty

Even though WebSphere Application Server traditional allows locally transacted JMS sessions, porting a WebSphere Application Server traditional locally transacted JMS session to Liberty is not allowed.

This rule flags Java code with references to the following methods when the transacted boolean is true or the sessionMode is Session.SESSION_TRANSACTED or JMSContext.SESSION_TRANSACTED:

Calling these methods with these specific values can result in different behavior in Liberty.

According to the JMS specification, in the Java EE web or EJB container:

In traditional WebSphere, the parameters that are passed in are not ignored in those scenarios, therefore allowing a locally transacted Session to be created. If that same application is run on Liberty without any changes, it might instead obtain either a non-transacted Session or have the created Session enlisted in an existing global transaction. In either case, if a Session or JMSContext is obtained, attempting to call commit() or rollback() on it will cause an exception to be thrown.

For information, see Liberty:Runtime environment known issues and restrictions.