AnsweredAssumed Answered

TaskList issues after using JPA in service tasks

Question asked by chris.joelly on Aug 18, 2011
Latest reply on Aug 24, 2011 by chris.joelly
Hello,

With JTA and CMP i have transaction issues when i create JPA entities using
a EJB looked up via JNDI from within a service task and store this entities as
process variables and later reuse them in another service task. Using the
entities within the servce task and the EJB is no problem as they are persisted
ok, but i have problems getting the task list via the TaskService after i run
a process with such service and user tasks. It seems that Activiti is then not
able to get a db session:


org.apache.ibatis.exceptions.PersistenceException:
### Error opening session.  Cause: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.RuntimeException: Got exception during XAResource.start:
### Cause: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.RuntimeException: Got exception during XAResource.start:
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
   at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:81)
   at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(DefaultSqlSessionFactory.java:32)
   at org.activiti.engine.impl.db.DbSqlSession.<init>(DbSqlSession.java:86)
   at org.activiti.engine.impl.db.DbSqlSessionFactory.openSession(DbSqlSessionFactory.java:77)
   at org.activiti.engine.impl.interceptor.CommandContext.getSession(CommandContext.java:177)
   at org.activiti.engine.impl.persistence.AbstractManager.getSession(AbstractManager.java:56)
   at org.activiti.engine.impl.persistence.AbstractManager.getDbSqlSession(AbstractManager.java:52)
   at org.activiti.engine.impl.persistence.entity.TaskManager.findTasksByQueryCriteria(TaskManager.java:89)
   at org.activiti.engine.impl.TaskQueryImpl.executeList(TaskQueryImpl.java:334)
   at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:138)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.AbstractQuery.list(AbstractQuery.java:112)
   at erp.web.faces.beans.activiti.TaskList.getOwnTasks(TaskList.java:62)


What can be wrong here in the Activiti configuration? Or maybe somewhere else?


   <jee:jndi-lookup jndi-name="jdbc/MysqlErp" id="dataSource" />
   <jee:jndi-lookup jndi-name="java:appserver/TransactionManager" id="transactionManager" />
   <bean id="processEngineConfiguration"
      class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration">
      <property name="transactionManager" ref="transactionManager"/>
      <property name="transactionsExternallyManaged" value="false" />
      <property name="dataSource" ref="dataSource" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="databaseType" value="mysql" />
   </bean>

Thanks in advance

Chris

Outcomes