6 Replies Latest reply on Jun 16, 2011 12:33 PM by it-student

    Work with complex process variable

    it-student Newbie

      Hi!

       

      Throw my process, I want to use a Project object to store the data. So I defined in the bpmn a process variable of type "Object" and set "Project" for the ClasseName. I put all in Guvnor. My Project class is in "other assets, documentation". When I try to build the package I get this error : "Project cannot be resolved to a Type". What can I do to make jBPM see my Class ?

       

      Thanks in advance,

       

      IT-Student

        • 1. Re: Work with complex process variable
          it-student Newbie

          Ok, found it

           

          In Drools create a new Model for the package by, for example, uploading a jar with the compiled class files.

          • 2. Re: Work with complex process variable
            it-student Newbie

            Hello,

             

            I'm always trying to use my Project Class in my process. So, I've create my class (package defaultPackage), compiled it and add the jar into Guvnor. In the top of the package page in "Configuration imported types" there is "defautlPackage.Project". In my bpmn I have a variable, Type : "Object", ClasseName: "defaultPackage.Project". The building in Guvnor works but when I start my process in the console an error occure :

             

            org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: defaultPackage/Project
            

             

            My BPMN :

             

            <?xml version="1.0" encoding="UTF-8"?> 
            <definitions id="Definition"
                         targetNamespace="http://www.jboss.org/drools"
                         typeLanguage="http://www.java.com/javaTypes"
                         expressionLanguage="http://www.mvel.org/2.0"
                         xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
                         xmlns:g="http://www.jboss.org/drools/flow/gpd"
                         xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
                         xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
                         xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
                         xmlns:tns="http://www.jboss.org/drools">
            
            
              <itemDefinition id="_mapItem" structureRef="java.util.HashMap" />
              <itemDefinition id="_quantityItem" structureRef="java.lang.String" />
              <itemDefinition id="_projectItem" structureRef="defaultPackage.Project" />
            
            
              <process processType="Private" isExecutable="true" id="project" name="Project" tns:packageName="defaultPackage" >
            
            
                <!-- process variables -->
                <property id="map" itemSubjectRef="_mapItem"/>
                <property id="quantity" itemSubjectRef="_quantityItem"/>
                <property id="project" itemSubjectRef="_projectItem"/>
            
            
                <!-- nodes -->
                <startEvent id="_1" name="StartProcess" />
                <endEvent id="_3" name="EndProcess" >
                    <terminateEventDefinition/>
                </endEvent>
                <userTask id="_4" name="TestTask" >
                  <ioSpecification>
                    <dataInput id="_4_ContentInput" name="Content" />
                    <dataInput id="_4_CommentInput" name="Comment" />
                    <dataInput id="_4_SkippableInput" name="Skippable" />
                    <dataInput id="_4_TaskNameInput" name="TaskName" />
                    <dataInput id="_4_ContentInput" name="Content" />
                    <dataInput id="_4_PriorityInput" name="Priority" />
                    <inputSet>
                      <dataInputRefs>_4_ContentInput</dataInputRefs>
                      <dataInputRefs>_4_CommentInput</dataInputRefs>
                      <dataInputRefs>_4_SkippableInput</dataInputRefs>
                      <dataInputRefs>_4_TaskNameInput</dataInputRefs>
                      <dataInputRefs>_4_ContentInput</dataInputRefs>
                      <dataInputRefs>_4_PriorityInput</dataInputRefs>
                    </inputSet>
                    <outputSet>
                    </outputSet>
                  </ioSpecification>
                  <dataInputAssociation>
                    <sourceRef>map</sourceRef>
                    <targetRef>_4_ContentInput</targetRef>
                  </dataInputAssociation>
                  <dataInputAssociation>
                    <targetRef>_4_CommentInput</targetRef>
                    <assignment>
                      <from xsi:type="tFormalExpression">Merci de confirmer le nom du projet.</from>
                      <to xsi:type="tFormalExpression">_4_CommentInput</to>
                    </assignment>
                  </dataInputAssociation>
                  <dataInputAssociation>
                    <targetRef>_4_SkippableInput</targetRef>
                    <assignment>
                      <from xsi:type="tFormalExpression">false</from>
                      <to xsi:type="tFormalExpression">_4_SkippableInput</to>
                    </assignment>
                  </dataInputAssociation>
                  <dataInputAssociation>
                    <targetRef>_4_TaskNameInput</targetRef>
                    <assignment>
                      <from xsi:type="tFormalExpression">TestTask</from>
                      <to xsi:type="tFormalExpression">_4_TaskNameInput</to>
                    </assignment>
                  </dataInputAssociation>
                  <dataInputAssociation>
                    <targetRef>_4_ContentInput</targetRef>
                    <assignment>
                      <from xsi:type="tFormalExpression"></from>
                      <to xsi:type="tFormalExpression">_4_ContentInput</to>
                    </assignment>
                  </dataInputAssociation>
                  <dataInputAssociation>
                    <targetRef>_4_PriorityInput</targetRef>
                    <assignment>
                      <from xsi:type="tFormalExpression"></from>
                      <to xsi:type="tFormalExpression">_4_PriorityInput</to>
                    </assignment>
                  </dataInputAssociation>
                  <potentialOwner>
                    <resourceAssignmentExpression>
                      <formalExpression>krisv</formalExpression>
                    </resourceAssignmentExpression>
                  </potentialOwner>
                </userTask>
                <scriptTask id="_5" name="Script" scriptFormat="http://www.java.com/java" >
                  <script>map = new java.util.HashMap();
            
            
            project.setName("hello");
            
            
            map.put("nomProjet", project.getName());
            kcontext.setVariable("map", map);</script>
                </scriptTask>
            
            
                <!-- connections -->
                <sequenceFlow id="_4-_3" sourceRef="_4" targetRef="_3" />
                <sequenceFlow id="_5-_4" sourceRef="_5" targetRef="_4" />
                <sequenceFlow id="_1-_5" sourceRef="_1" targetRef="_5" />
            
            
              </process>
            
            
              <bpmndi:BPMNDiagram>
                <bpmndi:BPMNPlane bpmnElement="project" >
                  <bpmndi:BPMNShape bpmnElement="_1" >
                    <dc:Bounds x="16" y="16" width="48" height="48" />
                  </bpmndi:BPMNShape>
                  <bpmndi:BPMNShape bpmnElement="_3" >
                    <dc:Bounds x="225" y="24" width="48" height="48" />
                  </bpmndi:BPMNShape>
                  <bpmndi:BPMNShape bpmnElement="_4" >
                    <dc:Bounds x="123" y="83" width="100" height="48" />
                  </bpmndi:BPMNShape>
                  <bpmndi:BPMNShape bpmnElement="_5" >
                    <dc:Bounds x="30" y="147" width="80" height="48" />
                  </bpmndi:BPMNShape>
                  <bpmndi:BPMNEdge bpmnElement="_4-_3" >
                    <di:waypoint x="173" y="107" />
                    <di:waypoint x="249" y="48" />
                  </bpmndi:BPMNEdge>
                  <bpmndi:BPMNEdge bpmnElement="_5-_4" >
                    <di:waypoint x="70" y="171" />
                    <di:waypoint x="173" y="107" />
                  </bpmndi:BPMNEdge>
                  <bpmndi:BPMNEdge bpmnElement="_1-_5" >
                    <di:waypoint x="40" y="40" />
                    <di:waypoint x="70" y="171" />
                  </bpmndi:BPMNEdge>
                </bpmndi:BPMNPlane>
              </bpmndi:BPMNDiagram>
            
            
            </definitions>
            

             

             

            Thanks in advance, it's very important,

             

            IT-Student

            • 3. Re: Work with complex process variable
              Esteban Aliverti Master

              Simple question: Is defaultPackage.Project class in your classpath when you try to start process? If not, add the jar containing your class in console's classpath.

               

              Best Regards,

              • 4. Re: Work with complex process variable
                it-student Newbie

                Hello Esteban,

                 

                Thank you for your response. Where is the console's classpath located (jbpm-installer/...) ?

                 

                Greetings,

                 

                IT-Student

                • 5. Re: Work with complex process variable
                  Esteban Aliverti Master

                  Since jbpm-console is a webapp, you will need to put you jar in JBoss AS classpath. One option could be

                  jbpm-installer-dir/jboss-5.1.0.GA/server/default/lib

                   

                  Another option might be to put you jar in the WEB-INF/lib directory inside jbpm-conlole war file.

                  • 6. Re: Work with complex process variable
                    it-student Newbie

                    Thank you. Works better but (there is a but) in the begin of my process (and before my firts human task) I've create a  script task :

                     

                    project = new Project(); 
                    project.setName("It works!");
                    
                    map = new java.util.HashMap();
                    map.put("projectName", project.getName());
                    
                    kcontext.setVariable("map", map);
                    kcontext.setVariable("project", project);
                    

                     

                    I get a RuntimeException in the line :

                     

                    kcontext.setVariable("project", project);
                    

                     

                    Do you have an idea why ?

                     

                    Greetings

                     

                    IT-Student