7 Replies Latest reply on Nov 14, 2007 2:37 PM by Ronald van Kuijk

    Token.signal() throws Exception from FieldInstantiator

    sidkennedy Newbie

      Hello again :)
      I have another problem. I have a processdefinition and I added some other xml-tags to a node for example as I thought that this is possible. Then I instantiate the definition, go for the RootToken and invoke signal() to start my process like this:

      process.getRootToken().signal();
      


      but the following exception is thrown:


      [ERROR] FieldInstantiator - -couldn't parse set field 'Tool' to value '<Tool xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">...</Tool>' <java.lang.NullPointerException>java.lang.NullPointerException
      at org.jbpm.instantiation.FieldInstantiator.setPropertyValue(FieldInstantiator.java:70)
      at org.jbpm.instantiation.FieldInstantiator.instantiate(FieldInstantiator.java:61)
      at org.jbpm.instantiation.Delegation.instantiate(Delegation.java:163)
      at org.jbpm.instantiation.Delegation.getInstance(Delegation.java:125)
      at org.jbpm.graph.def.Action.execute(Action.java:122)
      at org.jbpm.graph.def.Node.execute(Node.java:328)
      at org.jbpm.graph.def.Node.enter(Node.java:316)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:383)
      at org.jbpm.graph.node.StartState.leave(StartState.java:70)
      at org.jbpm.graph.exe.Token.signal(Token.java:178)
      at org.jbpm.graph.exe.Token.signal(Token.java:123)
      at myproject.workflowtools.views.WorkflowView$3.run(WorkflowView.java:214)
      at java.lang.Thread.run(Unknown Source)


      I don't know what I can do with that information because the process is completed successfully. But I don't like exceptions as you can imagine ;) Do you have an idea what I can do?

      greets

        • 1. Re: Token.signal() throws Exception from FieldInstantiator
          Ronald van Kuijk Master

          Yes, I have an idea:
          - post the full config of the specifc node
          - post the code of the action within this node

          • 2. Re: Token.signal() throws Exception from FieldInstantiator
            sidkennedy Newbie

            what do you mean with "full config of the specifc node "? the complete xml-structure of this node?

            here is the action:


            <node name="modelling System with Ameos">
             <transition name="success" to="end1"></transition>
             <action class="myproject.JpdlExecutionInvoker">
             <Tool
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <Name>UPPAAL-Plugin-Tool</Name>
             <ParamList xsi:type="PLEclipsePlugin">
             <PluginID>
             anotherproject.uppaaltools
             </PluginID>
             <MethodClass>
             anotherproject.uppaaltools.action.StartAmeosAction
             </MethodClass>
             <Method>
             run
             </Method>
             </ParamList>
             <InputContainer>
             <DataRow ID="input"></DataRow>
             <Converter xsi:type="tDCConverter"></Converter>
             <Save xsi:type="tDCSaveJava" />
             </InputContainer>
             <OutputContainer>
             <DataRow ID="input"></DataRow>
             <Converter xsi:type="tDCConverter"></Converter>
             <Save xsi:type="tDCSaveJava" />
             </OutputContainer>
             </Tool>
             </action>
             </node>
            


            • 3. Re: Token.signal() throws Exception from FieldInstantiator
              Ronald van Kuijk Master

              yes, and the code of the specific action

              and could you try to remove the xmlns:.... on the Tool element.

              btw, the Tool variable in the action should be of type 'Document'

              • 4. Re: Token.signal() throws Exception from FieldInstantiator
                sidkennedy Newbie

                I can't remove the xmlns because an exception is thrown otherwise.
                Here's the code of the JpdlExecutionInvoker:

                public class JpdlExecutionInvoker implements ActionHandler {
                
                 public void execute(ExecutionContext executionContext) throws Exception {
                 try {
                 // very project-specific statements
                 Date startDate = executionContext.getProcessInstance().getStart();
                 DataContainerManager dcManager = DataContainerManager
                 .getInstanceFor(startDate);
                 System.out.println(executionContext.getNode().getAction().getActionExpression());
                 TTool toolXML = Tool.unmarshal(new StringReader(executionContext
                 .getNode().getAction().getActionDelegation()
                 .getConfiguration()));
                
                 Display disp = Display.getCurrent();
                 if (disp == null) {
                 disp = new Display();
                 }
                 // execute Tool
                 ITool tool = ToolFactory.createTool(toolXML);
                
                 tool.execute(dcManager);
                 IStatus status = tool.getExecutionStatus();
                
                 // dependent on status, signal outgoing transition
                 if (status.equals(IStatus.SUCCESS)) {
                 String transition;
                 if (status instanceof JPDLStatus) {
                 transition = ((JPDLStatus) status).getTransition();
                 } else {
                 transition = "success";
                 }
                 executionContext.getToken().signal(transition);
                 return;
                 } else if (status.equals(IStatus.FAIL)) {
                 String transition;
                 if (status instanceof JPDLStatus) {
                 transition = ((JPDLStatus) status).getTransition();
                 } else {
                 transition = "failure";
                 }
                 executionContext.getToken().signal(transition);
                 return;
                 } else {
                 throw new IllegalArgumentException(
                 "Unknown tool execution status " + status);
                 }
                 } catch (Exception e) {
                 e.printStackTrace();
                 throw e;
                 }
                 }
                }
                
                
                does it help you to locate my fault?
                


                • 5. Re: Token.signal() throws Exception from FieldInstantiator
                  Ronald van Kuijk Master

                  Where is Tool declared? It is nowhere in your actionhandler

                  • 6. Re: Token.signal() throws Exception from FieldInstantiator
                    M. S. Newbie

                    Hello,

                    SidKennedy is my project partner and I have the same problem with this exception in a slightly different context.

                    @kukeltje
                    To answer your Question, yes, the Tool declaration is somewhere else.

                    I think the point is, that there is the XML action configuration that cannot be parsed in some kind of way. But I don't understand why. As I remember from the user guide, there is no xml schema or something like that that has to be validated when inserting the configuration inside of an action declaration in the jPDL.

                    Here is my action declaration:

                    <task-node name="Big Step1">
                     <task name="design modeling">
                     <event type="task-create">
                     <action class="org.sureal_projekt.spms.assignment.ResourceAssignmentHandler">
                     <resourceHooks>
                     <role group="PIM" />
                     <material group="PIM.design" />
                     <tool group="PIM.design" />
                     </resourceHooks>
                     </action>
                     </event>
                     </task>
                     <transition name="design modeling completed" to="Big Step2"></transition>
                     </task-node>


                    And here is my Exception:

                    18:31:31,265 ERROR [FieldInstantiator] couldn't parse set field 'resourceHooks' to value '<resourceHooks xmlns="urn:jbpm.org:jpdl-3.2">
                    <role group="PIM"/><material group="PIM.design"/><tool group="PIM.design"/></resourceHooks>'
                    java.lang.NullPointerException
                     at org.jbpm.instantiation.FieldInstantiator.setPropertyValue(FieldInstantiator.java:70)
                     at org.jbpm.instantiation.FieldInstantiator.instantiate(FieldInstantiator.java:61)
                     at org.jbpm.instantiation.Delegation.instantiate(Delegation.java:163)
                     at org.jbpm.instantiation.Delegation.getInstance(Delegation.java:125)
                     at org.jbpm.instantiation.Delegation$$FastClassByCGLIB$$6bae1598.invoke(<generated>)
                     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                     at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
                     at org.jbpm.instantiation.Delegation$$EnhancerByCGLIB$$c441f5db.getInstance(<generated>)
                     at org.jbpm.graph.def.Action.execute(Action.java:122)
                     at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235)
                     at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212)
                     at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182)
                     at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166)
                     at org.jbpm.taskmgmt.exe.TaskInstance.create(TaskInstance.java:169)
                     at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:144)
                     at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:167)
                     at org.jbpm.graph.def.Node.enter(Node.java:316)
                     at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
                     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                     at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
                     at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$af21a19d.enter(<generated>)
                     at org.jbpm.graph.def.Transition.take(Transition.java:119)
                     at org.jbpm.graph.def.Node.leave(Node.java:383)
                     at org.jbpm.graph.node.StartState.leave(StartState.java:70)
                     at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
                     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                     at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
                     at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$af21a19d.leave(<generated>)
                     at org.jbpm.graph.exe.Token.signal(Token.java:174)
                     at org.jbpm.graph.exe.Token.signal(Token.java:145)
                     at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>)
                     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                     at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
                     at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$5bb04831.signal(<generated>)
                     at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:241)


                    My Declaration of the invoked ResourceAssignmentHandler is very long, so I would like to avoid posting it here. :)
                    But as I said, I think, that's not the point. And as SidKennedy wrote, the code that is invoked by the action does work very well. There is only THIS Exception, that crashes my web application.

                    Do you have any idea what the problem might be?
                    Thanks in advance.
                    lou

                    • 7. Re: Token.signal() throws Exception from FieldInstantiator
                      Ronald van Kuijk Master

                      Without wanting to sound rude, the original class posted was a *full* classdefinition and so the Tool variable *cannot* be declared somewhere else. jBPM uses reflection to set variables if the action contains a xml. Your example might demonstrate the *same* problem. The code invoked by the action might work, the action itself might not. Please provide a unittest (with embedded processdefinition and a *minimal* but crashing actionhandler that demonstrates this problem. Then I'm willing to investigate further.