Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-3958

Global variables are not available after session restore.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 6.0.0
    • jBPM Core

      Description of problem:

      The following code will fail on NPE when rules are fired because they use the 'executed' global which is set before process start and is lost:

      KieBase kbase = createKnowledgeBaseFromResources(
      ResourceFactory.newClassPathResource("BPMN2-BusinessRuleTask-debug.bpmn2"),
      ResourceFactory.newClassPathResource("BPMN2-BusinessRuleTask.drl"));

      List<String> executeRuleList = new ArrayList<String>();
      KieSession ksession = createKnowledgeSession(kbase);
      ksession.setGlobal("executed", executeRuleList);
      ProcessInstance pi = ksession.startProcess("BPMN2-BusinessRuleTask");

      Assert.assertNotNull(pi);
      Assert.assertTrue(pi.getState() == ProcessInstance.STATE_ACTIVE);

      int sessionId = ksession.getId();
      System.out.println("Signal Continue");
      ksession.signalEvent("Continue", null);
      ksession.dispose();

      ksession = restoreKnowledgeSession(sessionId, kbase, null);
      System.out.println("Fire Rules");
      ksession.fireAllRules();
      ksession.dispose();

        1. process definition.bpmn2
          17 kB
          Marek Baluch
        2. Rule definition.drl
          0.9 kB
          Marek Baluch

              kverlaen@redhat.com Kris Verlaenen
              mbaluch@redhat.com Marek Baluch
              Tibor Zimányi Tibor Zimányi
              Tibor Zimányi Tibor Zimányi
              Lukáš Petrovický (Inactive), Rajesh Rajasekaran
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: