JBoss EAP 7 throws "Caused by: javax.jms.JMSRuntimeException: AMQ159004: Invalid Session Mode SESSION_TRANSACTED"

Solution Verified - Updated -

Issue

  • I am migrating my application from jboss 4.2.3 to jboss eap 7 . We used JMS interanlly to communicate within and outside the application using jbossmq which is default jms implementation in jboss 4.2.3. We used below code to create a transactioned session to push message into queue :
            connection = factory.createConnection(userName, password);
            session = connection.createSession(true, Session.SESSION_TRANSACTED);
            Destination destination = (Destination) ctx.lookup("queue/AABBCC");
            producer = session.createProducer(destination);
            TextMessage message = session.createTextMessage();

As because ActiveMQ Artemis is the default implementation in jboss eap 7, I am forced to change my code according to that which is shown below :

But I am getting below exception when I run my application .

ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 70) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./batchcontroller: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./batchcontroller: javax.servlet.ServletException: Error on batch controller startup servlet init
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.servlet.ServletException: Error on batch controller startup servlet init
    at aaa.bbb.ccc.servlet.MyServlet.doPerform(MyServlet.java:154)
    at aaa.bbb.ccc.servlet.MyServlet.init(MyServlet.java:67)
    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
    at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:239)
    at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:133)
    at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:527)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
    ... 6 more
Caused by: javax.jms.JMSException: Could not create a session: AMQ159004: Invalid Session Mode SESSION_TRANSACTED
    at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:895)
    at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:520)
....
....

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content