HI everyone,
I’m trying to roll my own tasklist in order to integrate it into my existing UI. Currently I am stuck with automatic updates of the list on new tasks. My initial attempt:
public void onTaskEventCreate(@Observes @CreateTask("Task_answerQuestions") BusinessProcessEvent businessProcessEvent)> {
taskListUpdatedEvent.fire(new TaskListUpdatedEvent(businessProcessEvent.getTask().getAssignee()));
}
Where taskListUpdateEvent is a CDI event. The code that is capturing this event queries the task service for an updated list for the user (taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(user).list()). Unfortunately, the returned list still contains the old tasks, not the new one. Therefore I deduce the “Create Task” event handler is called before the task is persisted. This is the same problem that is described here: Global task listener gets called before task is persistent
I then chose option 3 in the response to that post to remedy my issues, which lead to:
public void onTaskEventCreate(@Observes @CreateTask("Task_answerQuestions") BusinessProcessEvent businessProcessEvent)
{
org.camunda.bpm.engine.impl.context.Context.getCommandContext().getTransactionContext().addTransactionListener(TransactionState.COMMITTED, new TransactionListener() {
@Override
public void execute(CommandContext commandContext)
{
taskListUpdatedEvent.fire(new TaskListUpdatedEvent(businessProcessEvent.getTask().getAssignee()));
}
});
}
When I try to query the taskl service, the following exception is thrown:
### Error querying database. Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Task.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria
### The error occurred while executing a query
### Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Task.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria
### The error occurred while executing a query
### Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectList(DbSqlSession.java:95)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectListWithRawParameter(DbEntityManager.java:173)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectList(DbEntityManager.java:165)
at org.camunda.bpm.engine.impl.persistence.entity.TaskManager.findTasksByQueryCriteria(TaskManager.java:141)
at org.camunda.bpm.engine.impl.TaskQueryImpl.executeList(TaskQueryImpl.java:1261)
at org.camunda.bpm.engine.impl.AbstractQuery.evaluateExpressionsAndExecuteList(AbstractQuery.java:186)
at org.camunda.bpm.engine.impl.AbstractQuery.execute(AbstractQuery.java:163)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
at org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:58)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.AbstractQuery.list(AbstractQuery.java:137)
[...]
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)
at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
at org.apache.ibatis.transaction.managed.ManagedTransaction.openConnection(ManagedTransaction.java:89)
at org.apache.ibatis.transaction.managed.ManagedTransaction.getConnection(ManagedTransaction.java:60)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336)
at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:90)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
... 130 more
Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:424)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:747)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
... 140 more
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff0a356f89:-7d6703ee:5a859a5e:268 status: ActionStatus.COMMITTED >
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:408)
... 142 more
Does anyone have a hint for me what’s going south here?
Thanks in advance
Lukas