3 Replies Latest reply on Dec 4, 2012 2:14 PM by doboss

    How to deploy ScriptTask.bpmn from jbpm-examples

    doboss Newbie

      So I used to be quite fluent in JBPM 3 back in the day, but havn't touched any JBPM in about 2-3 years. Now I am looking to use JBPM in some of our upcoming application development.  I have been playing with JBPM 5.3 and now 5.4 for a few months now on and off as time allows. But I am having a hard time figuring out how things work together. I have downloaded and installed JBPM 5.4 via the full installer and played around with the evaluation example, the jbpm-console, and the guvnor. I have already read the entire JBPM user guide (although I admit, not in a single sitting.) I've also watched a lot of the videos and read some of the various blogs and forums... anyway, enough background...


      So I've opened up the jbpm-examples and I look at the very nice ScriptTask.bpmn and it's associated org.jbpm.examples.quickstarts HelloService.java and Person.java classes.


      I have Eclipse integrated with the Guvnor, and can upload the bpmn and even the .java file and have tried putting them in various packages. I have even created a simple jar (using Eclipse to export the .class files into a jar) and uploaded that into a few places in guvnor. Finally I've settled on providing a "quickstart.jar" (With the two .class files in it)  in the defaultPackage along side the ScriptTask.bpmn and the ScriptTask-image.png.


      When I try to build the package from the Guvnor I get errors like "Could not find variable 'HelloService' for action 'HelloService.getInstance().sayHello(person.getName());'" I think I have gotten past the ClassNotFound errors I was getting in the beginning.


      Also, when I look at the ScriptTask process asset it shows as invalid, but if I open it with the editor and click the validate button, it says "There are no validation errors."


      Okay, so here's my questions:

      1) Is there a way I can get this process and it's .java files up in the Guvnor and built?

      2) Will I then be able to run them from the jbpm-console or some other mechanism?


      If I can figure out these two things I can continue experimenting... my goal is to get a simple process inside JBoss that I can start. Eventually I would be starting the business processes from somewhere inside my web application... am I going down the right path?


      Thanks for the help!

        • 1. Re: How to deploy ScriptTask.bpmn from jbpm-examples
          doboss Newbie

          Or am I maybe asking the wrong question? I guess I don't really need to put anything Guvnor to be able to use JBPM right? I mean I can simply package up a servlet or something inside a war which has the JBPM libs and processes definitions, and just load the process from the classpath and start it right? So am I just being distracted by all the mention of the Guvnor in the documents and videos or am I missing something?

          • 2. Re: How to deploy ScriptTask.bpmn from jbpm-examples
            Tihomir Surdilovic Master

            To build your package in Guvnor, you have to add your model jars to it. For that in the top-left "Create New" menu select "Upload Pojo model jar" and name it and upload your jar.

            Note that jar files are not part of the compiled package (pkg) that Guvnor creates when you build a package and exposes it to your clients.

            You have to also have your model jar on the clients classpath.

            If you are using jbpm installer and testing execution of your processes in the jbpm console, easiest thing to do is to place your model jars in the $installer/dependencies directory and run


            ant clean.demo

            ant install.demo (or ant install.demo.noeclipse)

            and start.demo


            installer then will place your model jars in the right places for you for console.



            • 3. Re: How to deploy ScriptTask.bpmn from jbpm-examples
              doboss Newbie

              Thank you Tihomir!


              You're right (and I read about the Pojo model jar somewhere) and now my package compiles and even shows up in the jbpm-console!


              When I start it from the JBPM console, I get this error:


              11:55:38,483 ERROR [org.drools.persistence.SingleSessionCommandService] (http-localhost- Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [com.sample.script:1 - Script:2] -- unable to execute Action: [Error: null pointer: person.getName()]

              [Near : {... HelloService.getInstance().sayHello(person.getName()); ....}]


              [Line: 1, Column: 37]



              (The ^ is under the p in sayHello(person.getName )


              Which I suppose makes since because the person object was never created... So I'm thinking this example was never meant to be run in this fashion. Still, I don't see anything else in the examples which seems to run this particular bpmn.


              Thank you again for your help, sad I didn't put that together on my own.