6 Replies Latest reply on Oct 10, 2006 5:54 AM by tom.baeyens

    ProcessDefinition with no startTask

    mteira

      Trying to create a new ProcessInstance using the jbpm-console from a ProcessDefinition with no startTask throws an error in the jbpm-console. Something like:

      An Error Occurred:
      /common/taskform.xhtml @21,50 src="#{taskBean.taskFormPath}" /common/taskform.xhtml @21,50 src="#{taskBean.taskFormPath}": java.lang.NullPointerException


      The error is caused by:

      Caused by: java.lang.NullPointerException
       at org.jbpm.webapp.taskforms.TaskForms.getTaskFormPath(TaskForms.java:44)
       at org.jbpm.webapp.bean.TaskBean.getTaskFormPath(TaskBean.java:92)
       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 javax.el.BeanELResolver.getValue(BeanELResolver.java:218)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:62)
       at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      


      It seems that the root of the problem is org.jbpm.webapp.bean.TaskBean getTask() method returning null for a ProcessInstance without an StartTask, and so, we are eventually calling TaskForms.getTaskFormPath with a null argument from taskform.xhtml:

      <ui:define name="body">
       <ui:include src="#{taskBean.taskFormPath}" />
      ...
      



      So, should all ProcessDefinition has an StartTask form? Or should that form be included from taskform.xhtml only when it exists?

      Regards.


        • 1. Re: ProcessDefinition with no startTask
          dmlloyd

          Basically, you can't have a task form if there's no task. The error handling does need to be improved though. This is one thing that I am working on improving. NPEs are by far the worst offender in the web console...

          • 2. Re: ProcessDefinition with no startTask
            mteira

            Thanks for your response, David.

            What I actually wanted to know is whether a Process Definition without an start task (I understand that this is equivalent to a Process Definition with a task in the start-state node) is valid.
            From the jbpm-console operation point of view it doesn't makes a lot of sense (as it seems that every Process Definition must provide a start task form, included from taskform.xhtml), but I think that conceptually, there's no problem with a Process without an start task.

            Furthermore, the previous error showed because I deployed a process created from scratch using the Graphic Designer, where the 'start-state' node definition doesn't have a task. I've seen that the example process 'simple' created as a template by the 'new jpbm project' wizard, has an start-state containing:

            <start-state name="start">
             <task>
             <controller>
             <variable name="color" />
             <variable name="size" />
             </controller>
             </task>
             <transition name="to_state" to="first">
             <action name="action" class="com.sample.action.MessageActionHandler">
             <message>Going to the first state!</message>
             </action>
             </transition>
             </start-state>


            So, it has an start task.
            Anyway, after deploying this process definition, I was not able to create a new process instance, as no 'forms.xml' file is bundled with the project:

            Caused by: org.jbpm.JbpmException: couldn't get inputstream for file 'forms.xml'
            
             at org.jbpm.file.def.FileDefinition.getInputStream(FileDefinition.java:1
            29)
             at org.jbpm.webapp.taskforms.TaskForms.getProcessFormPaths(TaskForms.jav
            a:71)
             at org.jbpm.webapp.taskforms.TaskForms.getTaskFormPath(TaskForms.java:44
            )
             at org.jbpm.webapp.bean.TaskBean.getTaskFormPath(TaskBean.java:93)
             at sun.reflect.GeneratedMethodAccessor252.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at javax.el.BeanELResolver.getValue(BeanELResolver.java:218)
             at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
             at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELRe
            solver.java:62)
             at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
             at com.sun.el.parser.AstNotEqual.getValue(AstNotEqual.java:20)
             at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
            
             at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.ja
            va:71)
             ... 47 more
            Caused by: org.jbpm.JbpmException: file 'forms.xml' not found in db
             at org.jbpm.file.def.FileDefinition.getByteArray(FileDefinition.java:210
            )
             at org.jbpm.file.def.FileDefinition.getInputStreamFromDb(FileDefinition.
            java:169)
             at org.jbpm.file.def.FileDefinition.getInputStream(FileDefinition.java:1
            26)
             ... 60 more
            
            



            Don't missunderstand me. I'm not just complaining about these errors. What I would like to know is if they are my mistake or just bugs that need to be corrected. I'm trying to gain knowledge about how the whole thing works, and need to understand basic concepts as whether a process instance needs an start task, or I'm facing just an artificial dependency created by the jbpm-console, or just a bug (or my fault).

            Thanks a lot and regards.


            • 3. Re: ProcessDefinition with no startTask
              kukeltje

              afaik, the task should have a name. The name is mapped onto a form.

              • 4. Re: ProcessDefinition with no startTask
                tom.baeyens

                the mapping between task names and form file names is in the forms.xml file

                • 5. Re: ProcessDefinition with no startTask
                  mteira

                  Thanks a lot for all your comments. So, conceptually, are these scenarios valid:

                  1.-A ProcessDefinition with no start task.

                  2.-A ProcessDefinition with start task without a related form.


                  Are they supported?

                  Regards.

                  • 6. Re: ProcessDefinition with no startTask
                    tom.baeyens

                    yes. both should be supported.

                    A ProcessDefinition with no start task should not have a link in the webapp to start the process. At least not from the normal task management interface. It might be possible to start such a process as an admin type of functionality. But the latter is certainly some time in the future.

                    A ProcessDefinition with start task without a related form. That means that users actually are able to start the process without needing to feed data into it. In case the start state has multiple leaving transitions, the user will have to select the desired transition. So it might result into a form without data input, but with one button for each leaving transition.