[jboss-user] [jBPM] - fail to fire a rule task~~ frustrated

Guo-Guang Chiou do-not-reply at jboss.com
Wed Oct 12 21:39:06 EDT 2011


Guo-Guang Chiou [http://community.jboss.org/people/taitung.wilbert] created the discussion

"fail to fire a rule task~~ frustrated"

To view the discussion, visit: http://community.jboss.org/message/631470#631470

--------------------------------------------------------------
http://community.jboss.org/servlet/JiveServlet/showImage/2-631470-17155/testrule-image.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2-631470-17155/450-367/testrule-image.png 
I defined a process as the above.
between 2 script task there is a rule task.

here is my rule content. it's very simple.
============================================================
#created on: 2011/10/11
#list any import classes here.
import org.drools.runtime.process.WorkflowProcessInstance;
#declare any global variables here  
rule rule1 
          ruleflow-group "validate"
    when               
    then
         System.out.println( "TEST RULE ^^^" );
end
=============================================================


and process content is as following.

========================================================================================================
<?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"> 
  <process processType="Private" isExecutable="true" id="testrule" name="TestRule" tns:packageName="defaultPackage" > 
    <!-- nodes -->
    <startEvent id="_1" name="StartProcess" />
    <scriptTask id="_2" name="Script" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("Before rule\n");
                    org.drools.runtime.StatefulKnowledgeSession ksession = 
                         (org.drools.runtime.StatefulKnowledgeSession)
                          kcontext.getKnowledgeRuntime();
        ksession.fireAllRules();
System.out.println("After rule\n");</script>
    </scriptTask>
    <businessRuleTask id="_3" name="Rule" g:ruleFlowGroup="validate" >
    </businessRuleTask>
    <endEvent id="_4" name="End" >
        <terminateEventDefinition/>
    </endEvent>
    <scriptTask id="_5" name="Script" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("DONE");</script>
    </scriptTask>
    <!-- connections -->
    <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
    <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
    <sequenceFlow id="_5-_4" sourceRef="_5" targetRef="_4" />
    <sequenceFlow id="_3-_5" sourceRef="_3" targetRef="_5" /> 
  </process> 
  <bpmndi:BPMNDiagram>
    <bpmndi:BPMNPlane bpmnElement="testrule" >
      <bpmndi:BPMNShape bpmnElement="_1" >
        <dc:Bounds x="16" y="16" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_2" >
        <dc:Bounds x="96" y="16" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_3" >
        <dc:Bounds x="208" y="16" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_4" >
        <dc:Bounds x="432" y="16" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_5" >
        <dc:Bounds x="320" y="16" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_1-_2" >
        <di:waypoint x="40" y="40" />
        <di:waypoint x="136" y="40" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_2-_3" >
        <di:waypoint x="136" y="40" />
        <di:waypoint x="248" y="40" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_5-_4" >
        <di:waypoint x="360" y="40" />
        <di:waypoint x="456" y="40" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_3-_5" >
        <di:waypoint x="248" y="40" />
        <di:waypoint x="360" y="40" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram> 
</definitions>


========================================================================================================

in the first script task.
I have a code snippet to call fireAllRules in order to trigger rule task to work.
==================================================================
System.out.println("Before rule\n");
                    org.drools.runtime.StatefulKnowledgeSession ksession = 
                         (org.drools.runtime.StatefulKnowledgeSession)
                          kcontext.getKnowledgeRuntime();
        ksession.fireAllRules();
System.out.println("After rule\n");


===================================================================

and then I deployed all these artifacts to Guvnor repository by using Gnvnor plugin in eclipse.
the I open a browser to http://localhost:8080/jbpm-console to start a process.

i have been trying many ways to try to fire a rule task to work.
however, 
It always stops at rule task and can not mve to next script task.
I don't know why it goes this way.

 http://community.jboss.org/servlet/JiveServlet/downloadImage/2-631470-17156/450-88/Screenshot.png  (http://community.jboss.org/servlet/JiveServlet/showImage/2-631470-17156/Screenshot.png)
log file is attached.

any suggest and help will be appreciated.

Guo-Guang
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/631470#631470]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111012/f03d9086/attachment-0001.html 


More information about the jboss-user mailing list