1 Reply Latest reply on Apr 5, 2008 5:06 PM by Pete Muir

    Proper use of JBPM API in Seam?

    Brom bie Newbie

      Hi all,


      The project I'm working on requires me to go beyond the JBPM annotations in Seam and work with the API directly.  I've been trying to figure out the proper way to do this but unsure how to proceed.


      I have a process definition defined and it's working when I use the annotations (CreateProcess(definition...), BeginTask, EndTask all works), but when I try finding it using the API, I'm getting exceptions.


      Code:


      List all = ManagedJbpmContext.instance().getGraphSession().findAllProcessDefinitions();
      log.info(all.size());
      for (int i=0; i<all.size(); i++) {
           ProcessDefinition pd = (ProcessDefinition)all.get(i);
           log.info(pd.getName());
      }



      Exceptions:


      04:37:12,390 WARN  [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@1e12b2a
      04:37:12,421 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      04:37:12,421 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: b109c94:ead:47f13b18:72c 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: b109c94:ead:47f13b18:72c status: ActionStatus.ABORT_ONLY >))
      04:37:12,468 ERROR [STDERR] org.hibernate.exception.GenericJDBCException: Cannot open connection
           at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
           at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
           at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
           at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
           at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
           at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
           at org.hibernate.loader.Loader.doQuery(Loader.java:673)
           at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
           at org.hibernate.loader.Loader.doList(Loader.java:2220)
           at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
           at org.hibernate.loader.Loader.list(Loader.java:2099)
           at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
           at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
           at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
           at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
           at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
           at org.jbpm.db.GraphSession.findAllProcessDefinitions(GraphSession.java:210)
      



      findLatestProcessDefinition also throws the same exception.


      Once that happened, the following exceptions kept getting thrown until the server is restarted:


      04:37:43,187 ERROR [JDBCTransaction] JDBC commit failed
      java.sql.SQLException: You cannot commit during a managed transaction!
           at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:543)
           at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:334)
           at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
           at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
           at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:256)
           at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214)
           at org.jbpm.svc.Services.close(Services.java:225)
           at org.jbpm.JbpmContext.close(JbpmContext.java:139)
           at org.jbpm.job.executor.JobExecutorThread.getNextDueDate(JobExecutorThread.java:212)
           at org.jbpm.job.executor.JobExecutorThread.getWaitPeriod(JobExecutorThread.java:219)
           at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:69)
      04:37:43,187 ERROR [DbPersistenceService] hibernate commit failed
      org.hibernate.TransactionException: JDBC commit failed
           at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:130)
           at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:256)
           at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214)
           at org.jbpm.svc.Services.close(Services.java:225)
           at org.jbpm.JbpmContext.close(JbpmContext.java:139)
           at org.jbpm.job.executor.JobExecutorThread.getNextDueDate(JobExecutorThread.java:212)
           at org.jbpm.job.executor.JobExecutorThread.getWaitPeriod(JobExecutorThread.java:219)
           at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:69)
      Caused by: java.sql.SQLException: You cannot commit during a managed transaction!
           at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:543)
           at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:334)
           at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
           at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
           ... 7 more
      



      Obviously, I'm beating off the wrong path here.  Can anyone point me towards the right direction?


      Thanks for your help!