JTA LocalTaskService fails in WebSphere

Solution In Progress - Updated -

Issue

  • When trying to get localTaskService instance in WebSphere it gives the below error .
[10/17/13 18:17:33:092 IST] 000000ea SystemOut     O 18:17:33,092 ERROR TaskService:429 - Unable to find transaction: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.  This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request.  Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.  Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names.
java.lang.IllegalStateException: Unable to find transaction: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.  This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request.  Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.  Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names.
        at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:124)
        at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:69)
        at org.jbpm.task.service.persistence.TaskJTATransactionManager.<init>(TaskJTATransactionManager.java:37)
        at org.jbpm.task.service.persistence.TaskSessionFactoryImpl.createTaskPersistenceManager(TaskSessionFactoryImpl.java:85)
        at org.jbpm.task.service.persistence.TaskSessionFactoryImpl.createTaskServiceSession(TaskSessionFactoryImpl.java:75)
        at org.jbpm.task.service.TaskService.createSession(TaskService.java:203)
        at org.jbpm.task.service.TaskService.executeEscalatedDeadline(TaskService.java:288)
        at org.jbpm.task.service.TaskService$ScheduledTaskDeadline.call(TaskService.java:426)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
        at java.util.concurrent.FutureTask.run(FutureTask.java:149)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:109)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:217)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
        at java.lang.Thread.run(Thread.java:770)
Caused by: javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.  This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request.  Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.  Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".]
        at com.ibm.ws.naming.java.javaURLContextImpl.throwExceptionIfDefaultJavaNS(javaURLContextImpl.java:522)
        at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:552)
        at com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:481)
        at com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:485)
        at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:370)
        at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
        at javax.naming.InitialContext.lookup(InitialContext.java:436)
        at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:119)
        ... 14 more
Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
        at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1228)
        at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1141)
        at com.ibm.ws.naming.urlbase.UrlContextImpl.lookupExt(UrlContextImpl.java:1436)
        at com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:477)
        ... 19 more

And this is how the code is trying to get an instance of localTaskService:

Environment env = ksession.getEnvironment();
EntityManagerFactory emf = (EntityManagerFactory) env.get(EnvironmentName.ENTITY_MANAGER_FACTORY);
EscalatedDeadlineHandler deadlineHandler = new DefaultEscalatedDeadlineHandler();
org.jbpm.task.service.TaskService taskService = new org.jbpm.task.service.TaskService(emf, SystemEventListenerFactory.getSystemEventListener(), deadlineHandler);
LocalTaskService localTaskService = new LocalTaskService(taskService);

Environment

  • Red Hat JBoss BRMS (BRMS)
    • 5.3.1
  • WebSphere

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.