0 Replies Latest reply on May 5, 2008 7:19 PM by sln

    Problem integrating SEAM with jBPM

    sln

      Hi, I'm having trouble getting the todo-list jBPM sample to work with seam. jBPM is configured to use MySQL as data repository. When the app starts, it does create the db in MySQL, but when I try to list the activities, an exception is thrown.



      org.jbpm.JbpmException: couldn't get task instances list for actor 'xxx' at org.jbpm.db.TaskMgmtSession.findTaskInstances(TaskMgmtSession.java:65) at org.jbpm.JbpmContext.getTaskList(JbpmContext.java:189) at org.jboss.seam.bpm.TaskInstanceList.getTaskInstanceList(TaskInstanceList.java:40) at org.jboss.seam.bpm.TaskInstanceList.getTaskInstanceList(TaskInstanceList.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      ...
      12:54:47,296 ERROR [STDERR] ache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
          at java.lang.Thread.run(Thread.java:595)
      Caused by: 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)
      ...
      Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
          at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
          ... 113 more
      Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >
          at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:304)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
          ... 115 more
      12:54:47,312 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      12:54:47,312 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >)
      12:54:47,312 ERROR [TaskMgmtSession] org.hibernate.exception.GenericJDBCException: Cannot open connection
      12:54:47,312 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      12:54:47,312 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >)
      12:54:47,312 ERROR [TaskMgmtSession] org.hibernate.exception.GenericJDBCException: Cannot open connection
      12:54:47,328 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      12:54:47,328 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57ff36:83a:481f35bb:70 status: ActionStatus.ABORT_ONLY >)
      12:54:47,328 ERROR [TaskMgmtSession] org.hibernate.exception.GenericJDBCException: Cannot open connection
      12:54:47,375 WARN  [JTATransaction] You should set hibernate.transaction.manager_lookup_class if cache is enabled
      





      My code is as follows:



      psnakeBean (login)


      import ...
      
      @Stateful
      @Name("psnake")
      public class PsnakeBean implements Psnake {
      
          @In
          private Actor actor;
            
          private String user;
      
          public String getUser() {
              return user;
          }
      
          public void setUser(String user) {
              this.user = user;
          }
            
          public void psnake()
          {
             
          }
      
          @Destroy @Remove
          public void destroy() {
              // TODO Auto-generated method stub
             
          }
      
          public String logueate() {
              actor.setId(user);      
              return "/todoList.xhtml";
          }     
      }
      



      psnake's XHTML:


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:rich="http://richfaces.org/rich"
                      xmlns:a="http://richfaces.org/a4j"
                      template="layout/template.xhtml">
                            
      <ui:define name="body">
      
          <h:messages globalOnly="true" styleClass="message"/>
         
          <h:form id="psnakeForm">
      
              <rich:panel>
                  <f:facet name="header">LoginPseudoBPM</f:facet>
                  <s:decorate id="valueDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">User</ui:define>
                      <h:inputText id="value" required="true"
                                   value="#{psnake.user}"/>
                  </s:decorate>
                 
                  <div style="clear:both"/>
                 
              </rich:panel>
      
              <div class="actionButtons">
                  <h:commandButton id="psnake" value="psnake"
                          action="#{psnake.logueate}"/>                  
              </div>
      
          </h:form>
         
      </ui:define>
      
      </ui:composition>
      




      The todoListBean backbean:


      import ...
      
      @Stateful
      @Name("todoList")
      public class TodoListBean implements TodoList {
      
           private String description;
            
             public String getDescription()
             {
                return description;
             }
      
             public void setDescription(String description) {
                this.description = description;
             }
            
             @CreateProcess(definition="todo")
             public void createTodo() {}
            
             @StartTask @EndTask
             public void done() {}
      
          @Destroy @Remove
          public void destroy() {
              // TODO Auto-generated method stub
             
          }
      
          public void todoList() {
              // TODO Auto-generated method stub
             
          }
        
      }
      



      The todoList.xhtml page


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:rich="http://richfaces.org/rich"
                      xmlns:a="http://richfaces.org/a4j"
                      template="layout/template.xhtml">
                            
      <ui:define name="body">
      
          <f:view>
         <h:form id="list">
            <div>
               <h:outputText value="There are no todo items." rendered="#{empty
               taskInstanceList}"/>
               <h:dataTable value="#{taskInstanceList}" var="task" rendered="#{not empty taskInstanceList}">
                  <h:column>
                      <f:facet name="header">
                          <h:outputText value="Description"/>
                      </f:facet>
                      <h:inputText value="#{task.description}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">
                          <h:outputText value="Created"/>
                      </f:facet>
                      <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
                          <f:convertDateTime type="date"/>
                      </h:outputText>
                  </h:column>
                  <h:column>
                      <f:facet name="header">
                          <h:outputText value="Priority"/>
                      </f:facet>
                      <h:inputText value="#{task.priority}" style="width: 30"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header">
                          <h:outputText value="Due Date"/>
                      </f:facet>
                      <h:inputText value="#{task.dueDate}" style="width: 100">
                          <f:convertDateTime type="date" dateStyle="short"/>
                      </h:inputText>
                  </h:column>
                  <h:column>
                      <s:button value="Done" action="#{todoList.done}" taskInstance="#{task}"/>
                  </h:column>
               </h:dataTable>
            </div>
            <div>
            <h:messages/>
            </div>
            <div>
               <h:commandButton value="Update Items" action="update"/>
            </div>
         </h:form>
         <h:form id="new">
            <div>
               <h:inputText value="#{todoList.description}"/>
               <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
            </div>
         </h:form>
          </f:view>
      </ui:define>
      
      </ui:composition>
      
      




      ¿Any idea? Is there any config file not explicited in the docs I should be careful with ?


      Thanks in advance