2 Replies Latest reply on Aug 25, 2010 5:59 PM by Tim S

    jBpm 4.3 service task has no optional args?

    Tim S Newbie

      Hi,

       

      I've been looking at taskService in a BPMN2 process and I don't seem to be able to define an optional argument. If I define an arg such as:

       

           <jbpm:arg>
                  <jbpm:object expr="#{cc}" />
           </jbpm:arg>

       

      but do not have such a variable in the process instance by the time the task is invoked then it fails with the following error:

      [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.CompleteTaskCmd@f4189a
      org.jbpm.pvm.internal.wire.WireException: couldn't invoke method doTest: couldn't create argument 3: script evaluation error: javax.el.PropertyNotFoundException: Cannot find property cc
          at org.jbpm.bpmn.flownodes.JavaServiceTaskActivity.perform(JavaServiceTaskActivity.java:94)

       

      So it seems all args must exist or am I doing something wrong? I would prefer to handle optional params in my service class. What do you think?

       

      thanks in advance, Tim

        • 1. Re: jBpm 4.3 service task has no optional args?
          HuiSheng Xu Master

          Hi Tim,

           

          There is a little problem on jBPM-4.3.  It can't identify whether this specified variable is not existed or is null.  It had been fixed in jBPM-4.4.  I suggest you to have a try jBPM-4.4.

          • 2. Re: jBpm 4.3 service task has no optional args?
            Tim S Newbie

            Thanks for the reply. I did upgrade to 4.4 and after a little  head-scratching I realised I was encountering JBPM-2830. Your patch  restored my application built on 4.3 to the point that I can start and  list process instances so I'm hoping it is agreed to restore the  previous behaviour.

             

            I tried again to call a Java Service Task with an arg that is not populated at the time the service task is invoked:

                <itemDefinition id="registerUserItemDef" >
                     <jbpm:arg>
                         <jbpm:object expr="#{user}" />
                     </jbpm:arg>
                     <jbpm:arg>
                         <jbpm:object expr="#{groups}" />
                     </jbpm:arg>
                 </itemDefinition>

                ...

                <operation id="registerUser" name="registerUser">

             

            and this time I get a different error:

              org.jbpm.pvm.internal.wire.WireException: couldn't invoke  method registerUser: couldn't create argument 1: Cannot resolve  identifier 'groups'
                   at org.jbpm.bpmn.flownodes.JavaServiceTaskActivity.perform(JavaServiceTaskActivity.java:92)

             

            Once again, creating a variable named groups allows the service task to be invoked successfully.

            Tim