JTA transaction error inside jboss portal
lpiccoli Jul 27, 2009 2:39 AMportal 2.7.2
jbpm 3.2.2
hi all
when accessing the JBPM context inside a portlet of jboss portal the following JTA error occurs depending whether the the context is created or get Current is called.
i read the details of jbpm transation here
http://docs.jboss.org/jbpm/v3/userguide/deployment.html
I thought i understood the JBPM JTA settings but i have totally lost now.
my JTA settings are below.
<jbpm-context> <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" /> <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" /> <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" /> <service name="tx" factory="org.jbpm.tx.TxServiceFactory"/> </jbpm-context>
When calling getCurrentJbpmContext() as in below, a 'Session closed' error occurs.
WorkflowService workflowService = (WorkflowService) ctx.lookup("java:/portal/WorkflowService") writer.println( "workflowService:" + workflowService ); JbpmContext context = workflowService.getJbpmConfiguration().getCurrentJbpmContext(); List<ProcessDefinition> taskList = context.getGraphSession().findAllProcessDefinitions();
So an existing context is found but the hibernate session is closed.
2009-07-27 16:21:52,222 ERROR [STDERR] org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49) at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1258) at org.jbpm.db.GraphSession.findAllProcessDefinitions(GraphSession.java:209) at org.jboss.portal.portlet.samples.SimplestHelloWorldPortlet.doView(SimplestHelloWorldPortlet.java:76)
So when i call createJbpmContext(), the JTA complains that an existing transaction is already on the current thread.
WorkflowService workflowService = (WorkflowService) ctx.lookup("java:/portal/WorkflowService") writer.println( "workflowService:" + workflowService ); JbpmContext context = workflowService.getJbpmConfiguration().createJbpmContext(); List<ProcessDefinition> taskList = context.getGraphSession().findAllProcessDefinitions();
Cause: org.jboss.portal.portlet.PortletInvokerException: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction! Message: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction! StackTrace: org.jboss.portal.portlet.PortletInvokerException: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction! at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:101) at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82) at org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor.invoke(SecureTransportInterceptor.java:69) at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82) at org.jboss.portal.portlet.aspects.portlet.ValveInterceptor.invoke(ValveInterceptor.java:75) at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82) at org.jboss.portal.portlet.container.ContainerPortletInvoker.invoke(ContainerPortletInvoker.java:116)
how is jbpm configured to use the existing JTA inside portal?
any help is most appreciated.
-lp