3 Replies Latest reply on Aug 22, 2007 1:53 PM by jplenhart

    Examples

    jplenhart

      I downloaded jbpm-jpdl-3.2.1 ... the suite.

      I unzipped and tried to create an eclipse project as instructed but it did not work. I then tried to just create a simple java project with all the jars in the lib and the two jbpm jars at the root. When I run the unit test case in the 'action' project I get the following, I assume these can be run standalone (Any help is appreciated ... just trying to work on a company use-case and off to a bad start):

      org.jbpm.graph.def.DelegationException
      at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:376)
      at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:367)
      at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:270)
      at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:220)
      at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:190)
      at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:174)
      at org.jbpm.graph.def.Node.enter(Node.java:302)
      at org.jbpm.graph.def.Transition.take(Transition.java:151)
      at org.jbpm.graph.def.Node.leave(Node.java:393)
      at org.jbpm.graph.node.StartState.leave(StartState.java:70)
      at org.jbpm.graph.exe.Token.signal(Token.java:194)
      at org.jbpm.graph.exe.Token.signal(Token.java:139)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:270)
      at org.jbpm.examples.action.ActionTest.testNodeActions(ActionTest.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.NullPointerException
      at org.jbpm.graph.def.Action.execute(Action.java:122)
      at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:255)
      ... 29 more

        • 1. Re: Examples
          kukeltje

          show some unittest, processdef etc..etc...etc..

          • 2. Re: Examples
            jplenhart

            Hi Ronald,

            First off thank you for the reply --- been having a bad week in the world of JBoss:-)

            All I am trying to get going is the most basic example, here is a method from the 'action' example.

            public void testTransitionAction() {
             // The next process is a variant of the hello world process.
             // We have added an action on the transition from state s
             // to the end-state. The purpose of this test is to show
             // how easy it is to integrate java code in a jBPM process.
             ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
             "<process-definition>" +
             " <start-state>" +
             " <transition to='s' />" +
             " </start-state>" +
             " <state name='s'>" +
             " <transition to='end'>" +
             " <action class='org.jbpm.tutorial.action.MyActionHandler' />" +
             " </transition>" +
             " </state>" +
             " <end-state name='end' />" +
             "</process-definition>"
             );
            
             // Let's start a new execution for the process definition.
             ProcessInstance processInstance =
             new ProcessInstance(processDefinition);
            
             // The next signal will cause the execution to leave the start
             // state and enter the state 's'
             processInstance.signal();
            
             // Here we show that MyActionHandler was not yet executed.
             assertFalse(MyActionHandler.isExecuted);
             // ... and that the the main path of execution is positioned in
             // the state 's'
             assertSame(processDefinition.getNode("s"),
             processInstance.getRootToken().getNode());
            
             // The next signal will trigger the execution of the root
             // token. The token will take the transition with the
             // action and the action will be executed during the
             // call to the signal method.
             processInstance.signal();
            
             // Here we can see that MyActionHandler was executed during
             // the call to the signal method.
             assertTrue(MyActionHandler.isExecuted);
             }
            


            The process definition is hardcoded - I have all the jars in my build path.

            I do not see an ant build file associated with this sample either so I am just trying to use the JUnit plugin from eclipse.

            Thanks,

            Jason

            • 3. Re: Examples
              jplenhart

              The problem is the class in the hardcoded process definition does not match the directory structure of the suite packaging.

              This should probably be made part of your CI environment right...

              Thanks,

              Jason