7 Replies Latest reply on Sep 26, 2006 10:32 AM by Gavin King

    JBPM and Seam integration. What am I doing wrong?

    Alexei none Apprentice

      So I created a process by means of the @CreateProcess annotation

      @Stateful
      @Name("createOrder")
      public class CreateOrderImpl implements CreateOrder, Serializable {

      @Logger
      Log log;
      ............................................
      @CreateProcess(definition="order issuing")
      public void startWorkflow() {

      log.debug("workflow started 'orderIssuing'");

      }
      ............................................
      @Destroy
      @Remove
      public void destroy() {
      }
      }


      The process defenition is

      <?xml version="1.0"?>

      <process-definition name="order issuing">
      <start-state name="start">

      </start-state>
      <task-node name="create order">

      <assignment pooled-actors="inspectors"/>
      <!--assignment actor-id="#{actor.id}"/-->


      </task-node>
      <task-node name="deans sign">

      <assignment pooled-actors="deans"/>
      <!--assignment actor-id="#{actor.id}"/-->



      </task-node>
      <task-node name="lawyers sign">

      <assignment pooled-actors="lawyers"/>
      <!--assignment actor-id="#{actor.id}"/-->



      </task-node>
      <end-state name="end"></end-state>
      <task-node name="correct document">

      <assignment pooled-actors="inspectors"/>
      <!--assignment actor-id="#{actor.id}"/-->


      </task-node>
      </process-definition>

      Then I output tasks for current actor

      <h:dataTable value="#{pooledTaskInstanceList}"
      var="task"
      styleClass="dvdtable"
      headerClass="dvdtablehead"
      rowClasses="dvdtableodd,dvdtableeven"
      columnClasses="dvdtablecol">
      <h:column>
      <f:facet name="header">??????</f:facet>
      <h:outputText value="#{task.description}" />
      </h:column>
      <h:column>
      <f:facet name="header">??????</f:facet>
      <h:outputText value="#{task.create}" />
      </h:column>
      <h:column>
      <f:facet name="header">????</f:facet>
      <h:outputText value="#{task.variables['file'].name}" />
      </h:column>
      <h:column>
      <s:link action="#{pooledTask.assignToCurrentActor}" taskInstance="#{task}" value="????????" linkStyle="button"/>
      </h:column>
      </h:dataTable>

      And if you click on <s:link.../> you will redirected to upload.xhtml by means of navigation rule

      </faces-config>
      ..............
      <navigation-rule>
      <navigation-case>
      <from-action>#{pooledTask.assignToCurrentActor}</from-action>
      <from-outcome>taskAssignedToActor</from-outcome>
      <to-view-id>/upload.xhtml</to-view-id>

      </navigation-case>
      </navigation-rule>
      ..............
      </faces-config>

      Here is the page source

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      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:s="http://jboss.com/products/seam/taglib"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:t="http://myfaces.apache.org/tomahawk">

      <ui:composition template="/WEB-INF/template.xhtml">
      <ui:define name="topnav">
      <ui:include src="/WEB-INF/incl/store_nav.xhtml">
      <ui:param name="page" value="home" />
      </ui:include>
      </ui:define>

      <ui:define name="sidebar">
      <ui:include src="/WEB-INF/incl/login.xhtml" />
      </ui:define>

      <ui:define name="body">
      <h1>???????? ???????</h1>
      <h:form enctype="multipart/form-data">
      <h:outputText value="#{createOrder.fileContent}"/>
      <t:inputFileUpload storage="input_file" value="#{createOrder.file}"/>
      <h:commandButton value="?????????" action="#{createOrder.upload}"/>
      <h:commandButton action="#{taskManager.startTask}" value="Start task"/>
      <h:commandButton action="#{taskManager.endTask}" value="End task"/>
      <h:outputText value="#{taskManager.test}"/>
      <h:messages/>
      </h:form>
      </ui:define>
      </ui:composition>



      and its backing bean

      @Name("taskManager")
      public class TaskManagerImpl {

      @Logger
      Log log;

      public String getTest() {
      return "test";
      }

      @Create
      @StartTask
      public void startTask() {
      log.debug("task started");
      }

      @EndTask
      public void endTask() {
      log.debug("task ended");
      }

      }

      Now the problem is that the following exception occures while TaskManagerImpl.startTask() invocation


      2006-09-25 12:53:22,328 ERROR [STDERR] java.lang.NullPointerException
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.initTask(BusinessProcessInterceptor.java:95)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.beforeInvocation(BusinessProcessInterceptor.java:73)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:59)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:34)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.bmstu.orders.processmanagment.beans.TaskManagerImpl$$EnhancerByCGLIB$$73a226a3.startTask()
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:1334)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:1322)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:1312)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1263)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1246)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
      2006-09-25 12:53:22,328 ERROR [STDERR] at javax.faces.component.UIOutput.getValue(UIOutput.java:75)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
      2006-09-25 12:53:22,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.writeAttributes(DevTools.java:240)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.writeStart(DevTools.java:277)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:189)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:133)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.tag.ui.UIDebug.writeDebugOutput(UIDebug.java:78)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.tag.ui.UIDebug.encodeBegin(UIDebug.java:67)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:232)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
      2006-09-25 12:53:22,328 ERROR [STDERR] at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:554)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
      2006-09-25 12:53:22,328 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      2006-09-25 12:53:22,328 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      2006-09-25 12:53:22,328 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)

      Any ideas?

      P.S. Sorry 4 my poor english :)

        • 1. Re: JBPM and Seam integration. What am I doing wrong?
          Gavin King Master

          Are you passing the task id in the "taskId" request parameter when you call startTask() ?


          • 2. Re: JBPM and Seam integration. What am I doing wrong?
            Alexei none Apprentice

            Well, actually I didnt. But pooledTask.assignToCurrentActor worked fine, does not that mean, that somebody already outjected taskId variable?

            • 3. Re: JBPM and Seam integration. What am I doing wrong?
              Alexei none Apprentice

              And by the way, are there any ways to pass "taskId" when I call endTask().

              • 4. Re: JBPM and Seam integration. What am I doing wrong?
                Gavin King Master

                 

                "Jump" wrote:
                Well, actually I didnt. But pooledTask.assignToCurrentActor worked fine, does not that mean, that somebody already outjected taskId variable?


                No. Follow the example apps and the reference documentation. Don't try and invent new ways of doing things until you really understand how the standard way works.

                • 5. Re: JBPM and Seam integration. What am I doing wrong?
                  Gavin King Master

                   

                  "Jump" wrote:
                  And by the way, are there any ways to pass "taskId" when I call endTask().


                  You do not need to do that because @StartTask starts a conversation and associates the task with the conversation.

                  Please follow the examples.

                  • 6. Re: JBPM and Seam integration. What am I doing wrong?
                    Alexei none Apprentice

                     

                    "gavin.king@jboss.com" wrote:

                    No. Follow the example apps and the reference documentation. Don't try and invent new ways of doing things until you really understand how the standard way works.


                    What are standart ways? TODO sample app? But what if I need to assign task firs and than start it? Well, actually, I sloved that problem, but I dont like my suggestion. First of all I made 2 tables
                    1)
                    <h:dataTable value="#{pooledTaskInstanceList}"
                    var="task"
                    styleClass="dvdtable"
                    headerClass="dvdtablehead"
                    rowClasses="dvdtableodd,dvdtableeven"
                    columnClasses="dvdtablecol">
                    ..........................................
                    <h:column>
                    <s:link action="#{pooledTask.assignToCurrentActor}" taskInstance="#{task}" value="Pick task" linkStyle="button"/>
                    </h:column>
                    ..........................................
                    </h:dataTable>
                    2)
                    <h:dataTable value="#{taskInstanceList}"
                    var="task"
                    styleClass="dvdtable"
                    headerClass="dvdtablehead"
                    rowClasses="dvdtableodd,dvdtableeven"
                    columnClasses="dvdtablecol">
                    ................................................
                    <h:column>
                    <s:link action="#{taskManager.startTask}" taskInstance="#{task}" value="Start task" linkStyle="button"/>
                    </h:column>
                    <h:column>
                    <s:link action="#{taskManager.endTask}" taskInstance="#{task}" value="end task" linkStyle="button"/>
                    </h:column>
                    ..................................................
                    </h:dataTable>

                    then I modified TaskManagerImpl


                    @Name("taskManager")
                    public class TaskManagerImpl {

                    @Logger
                    Log log;

                    public String getTest() {
                    return "test";
                    }

                    public void startTask() {

                    String taskId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("taskId");
                    System.out.println("taskId is " + taskId);
                    TaskInstance taskInstance = (TaskInstance) ManagedJbpmContext.instance().getTaskMgmtSession().loadTaskInstance( Long.parseLong(taskId) );
                    taskInstance.start();

                    }

                    public void endTask() {

                    String taskId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("taskId");
                    System.out.println("taskId is " + taskId);
                    TaskInstance taskInstance = (TaskInstance) ManagedJbpmContext.instance().getTaskMgmtSession().loadTaskInstance( Long.parseLong(taskId) );
                    taskInstance.end();

                    }

                    }

                    It works now, but it looks ugly/ Are there any other ways?


                    • 7. Re: JBPM and Seam integration. What am I doing wrong?
                      Gavin King Master

                       

                      "Jump" wrote:
                      "gavin.king@jboss.com" wrote:

                      No. Follow the example apps and the reference documentation. Don't try and invent new ways of doing things until you really understand how the standard way works.


                      What are standart ways? TODO sample app?


                      The DVD Store demo, and the reference manual.