transaction error using seam component
benitojuarez Aug 13, 2009 9:52 AMHello,
in jbpm process definition i configured a swimlane using a seam component:
<swimlane name="BUYERS">
<assignment pooled-actors="#{securityModelManager.getLoginsOfRole('BUYER')}"></assignment>
</swimlane>
The called method:
@TransactionAttribute(REQUIRES_NEW)
public List<String> getLoginsOfRole(String roleName)
{
String sql = "SELECT username FROM user u "
+ "left join userroles ur on ur.UserId = u.UserId "
+ "left join role r on ur.RoleId = r.RoleId "
+ "where r.rolename = :roleName";
Query query = entityManager.createNativeQuery(sql);
query.setParameter("roleName", roleName );
return query.getResultList();
}
Now on task creation i get the following exception:
09:36:47,429 ERROR [JDBCExceptionReporter] Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a964180:47c:4a83bfc1:cd status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a964180:47c:4a83bfc1:cd status: ActionStatus.ABORT_ONLY >))
09:36:47,429 INFO [SecurityModelManager] getLoginsOfRole() sql:SELECT username FROM user u left join userroles ur on ur.UserId = u.UserId left join role r on ur.RoleId = r.RoleId where r.rolename = :roleName roleName:BUYER
09:36:47,429 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
09:36:47,429 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: a964180:47c:4a83bfc1:cd status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a964180:47c:4a83bfc1:cd status: ActionStatus.ABORT_ONLY >)
09:36:47,429 ERROR [SeamExpressionEvaluator] Exceptions occurred when parsing ${securityModelManager.getLoginsOfRole('BUYER')}
09:36:47,429 ERROR [SeamExpressionEvaluator] Possible cause
javax.el.ELException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.jboss.seam.bpm.SeamExpressionEvaluator$1.evaluate(SeamExpressionEvaluator.java:92)
at org.jboss.seam.bpm.SeamExpressionEvaluator.evaluate(SeamExpressionEvaluator.java:45)
at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:39)
at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:30)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignmentPooledActorsExpr(TaskMgmtInstance.java:249)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:207)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.getInitializedSwimlaneInstance(TaskMgmtInstance.java:184)
at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:197)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:154)
at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:168)
at org.jbpm.graph.def.Node.enter(Node.java:319)
The method works, if i call it from jsf view or another seam component.
Any ideas?
Grz.
BJ