Attached is a simple Eclipse project which creates a deployable web app which contains all the basics to run JBPM 5.4 inside a web app ussing persistence. The project is deployed in a JBoss AS 7.1.1 server which was created using the JBPM 5.4 installer. This project uses PostgreSQL as the database. The JBPM process is read from a local Guvnor instance.
This example was created by combining a few other existing examples together and then adding some stuff I've figured out along the way.
Anyway, hopefully this will help get people going using JBPM in thier own web apps.
Here are the instructions which are also found in the web apps home page:
- Install your jdbc drivers into your JBoss AS installation. (I did mine as a module following this.)
- Create a new empty database/schema called "testJBPM" in your database with permissions for a user "jbpm" and password "jbpm". (If you are not using PostgreSQL or want to change the connection information, update jbpm-in-webapp-ds.xml)
- Create a new package in Guvnor called "testPackage". (Change the URL in KBaseService and the packageName in ScriptTeask.bpmn if you want to use a different package name)
- Create a pojo model jar containing HelloService.java and Person.java the and deploy it to the testPackage inside guvnor. (From eclipse basically select the 2 files and do "Export->Java->Jar file. Name it whatever and upload it to Guvnor")
- Upload ScriptTask.bpmn to Guvnor in the same package.
- Build the testPackage in Guvnor (Click "Build package" button in the edit tab))
- Deploy this web app to your jboss server (The needed tables will be built in your database because "hibernate.hbm2ddl.auto" is set to "update" in persistence.xml)
- Go to http://localhost:8080/jbpm-in-webapp/