JBPM console how to attach your custom form template to your custom process

If you are playing with jbpm_cosole like I am then the of of the first question will be – how can I attach my own form template (ftl).

Why I did not use guvnor? The reasone was that it did not work on my environment – Mac Os X and I also tried on Centos 6.x. I was getting all the time I started Jboss server to log:

14:08:30,328 INFO  [org.drools.repository.RulesRepositoryConfigurator] (http-localhost-127.0.0.1-8080-12) Creating an instance of the RulesRepositoryConfigurator.

14:08:33,202 INFO  [stdout] (http-localhost-127.0.0.1-8080-12) =============== session-admin-4

14:08:33,826 ERROR [org.jbpm.integration.console.shared.GuvnorConnectionUtils] (http-localhost-127.0.0.1-8080-8) Error retriving packages from guvnor: Invalid argument

So I discovered where jbpm_console looking for form templates and the place was – WEB-INF/lib/ on the deployed jbpm-gwt-console-server.war

* I created form template for my task – DemoHumanTask.ftl (DemoHumanTask – taskname in bpmn), process start form template – com.sample.demo.bpmn.ftl (com.sample.demo.bpmn is process id)

* make jar :

margusja@IRack:~/Downloads/jbpm-installer/jboss-as-7.1.1.Final/standalone/dev_war/dev_jar/margusja$ jar cvf MargusjademoProcess.jar .
added manifest
adding: com.sample.demo.bpmn.ftl(in = 317) (out= 212)(deflated 33%)
adding: DemoHumanTask.ftl(in = 1418) (out= 487)(deflated 65%)

* go back to the place where did you unpack your jbpm-gwt-console-server.war and copy created jar file to the right place:

cp ./dev_jar/margusja/MargusjademoProcess.jar ./WEB-INF/lib/

* update jbpm-gwt-console-server.war file

margusja@IRack:~/Downloads/jbpm-installer/jboss-as-7.1.1.Final/standalone/dev_war$ jar uvf jbpm-gwt-console-server.war WEB-INF/lib/MargusjademoProcess.jar
adding: WEB-INF/lib/MargusjademoProcess.jar(in = 7722) (out= 7396)(deflated 4%)

* copy updated war file to the jboss deployments directory

* restart jboss server (they say that jboss should handle on the fly new deployed wars but in my case I got errors)

* after restart I managed to see new forms generated from my form templates:

Screen Shot 2013-02-10 at 4.01.25 PM Screen Shot 2013-02-10 at 4.01.41 PM Screen Shot 2013-02-10 at 4.12.41 PM

JBPM console – edit default form template (DefaultTask.ftl)

My first coal was create own form template to my process.

But I managed to change defaultTask template and demo process’ task (Performance Evaluation.ftl)  template.

Make backup from original jbpm-gwt-console-server.war – otherwise if you mess up your war file you have to install all the jboss server again.

* copy jbpm-gwt-console-server.war somewhere you can play with it. in my example iI put it /Users/margusja/Downloads/jbpm-installer/jboss-as-7.1.1.Final/standalone/dev_war

* unpack your war – jar xvf jbpm-gwt-console-server.war

* You will find WEB-INF/lib/jbpm-gwt-form-5.4.0.Final.jar

* copy it somewhere where you can play with it – in my case I created a new directory : dev_jar and copied it there

* cd into your new directory and unpack jar – jar xvf jbpm-gwt-form-5.4.0.Final.jar

* You will find form templates like DefaultTask.ftl, Performance Evaluation.ftl and com.sample.evaluation.ftl

* modify them like you wish fish – Do not change Form action

* pack the stuff again to the jar:

margusja@IRack:~/Downloads/jbpm-installer/jboss-as-7.1.1.Final/standalone/dev_war/dev_jar/dev_jbpm-gwt-form$ jar cvf jbpm-gwt-form-5.4.0.Final.jar .
added manifest
adding: classlist.mf(in = 282) (out= 101)(deflated 64%)
adding: com.sample.evaluation.ftl(in = 346) (out= 231)(deflated 33%)
adding: DefaultTask.ftl(in = 281) (out= 197)(deflated 29%)
adding: FormBuilder.properties(in = 61) (out= 54)(deflated 11%)
ignoring entry META-INF/
ignoring entry META-INF/MANIFEST.MF
adding: META-INF/maven/(in = 0) (out= 0)(stored 0%)
adding: META-INF/maven/org.jbpm/(in = 0) (out= 0)(stored 0%)
adding: META-INF/maven/org.jbpm/jbpm-gwt-form/(in = 0) (out= 0)(stored 0%)
adding: META-INF/maven/org.jbpm/jbpm-gwt-form/pom.properties(in = 112) (out= 108)(deflated 3%)
adding: META-INF/maven/org.jbpm/jbpm-gwt-form/pom.xml(in = 1319) (out= 422)(deflated 68%)
adding: META-INF/services/(in = 0) (out= 0)(stored 0%)
adding: META-INF/services/org.jboss.bpm.console.server.plugin.FormDispatcherPlugin(in = 58) (out= 56)(deflated 3%)
adding: org/(in = 0) (out= 0)(stored 0%)
adding: org/jbpm/(in = 0) (out= 0)(stored 0%)
adding: org/jbpm/integration/(in = 0) (out= 0)(stored 0%)
adding: org/jbpm/integration/console/(in = 0) (out= 0)(stored 0%)
adding: org/jbpm/integration/console/forms/(in = 0) (out= 0)(stored 0%)
adding: org/jbpm/integration/console/forms/AbstractFormDispatcher$1.class(in = 1700) (out= 782)(deflated 54%)
adding: org/jbpm/integration/console/forms/AbstractFormDispatcher.class(in = 6061) (out= 2703)(deflated 55%)
adding: org/jbpm/integration/console/forms/ConfigurationUtils.class(in = 3788) (out= 1906)(deflated 49%)
adding: org/jbpm/integration/console/forms/FormDispatcherComposite$1.class(in = 982) (out= 527)(deflated 46%)
adding: org/jbpm/integration/console/forms/FormDispatcherComposite.class(in = 2073) (out= 872)(deflated 57%)
adding: org/jbpm/integration/console/forms/ProcessFormDispatcher.class(in = 1250) (out= 584)(deflated 53%)
adding: org/jbpm/integration/console/forms/TaskFormDispatcher.class(in = 4070) (out= 2002)(deflated 50%)
adding: Performance Evaluation.ftl(in = 1461) (out= 500)(deflated 65%)

* go back where did you unpacked your war file

* copy new jar file to the right place – cp ./dev_jar/dev_jbpm-gwt-form/jbpm-gwt-form-5.4.0.Final.jar ./WEB-INF/lib/jbpm-gwt-form-5.4.0.Final.jar

* update your original war – jar uvf jbpm-gwt-console-server.war WEB-INF/lib/jbpm-gwt-form-5.4.0.Final.jar

* put a updated war to jboss deployments/ directory – cp jbpm-gwt-console-server.war ../deployments/

In my case I restarted jboss and after it started up I logged to jbpm_console: http://localhost:8080/jbpm-console/ and opened user task I saw that my changes I made are deployed :

Screen Shot 2013-02-10 at 3.20.21 PM Screen Shot 2013-02-10 at 3.20.37 PM

JBPM2 – deploy a new process into JBoss server


Create jar from your assets
Create war from jar (jar cvf name.war [jar file])
Put it into JBoss deployments directory
Into JBoss server log have to appear something like
16:34:43,931 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of “YOURWARNAME.war”
16:34:44,057 INFO [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /YOURPROCESS
16:34:44,086 INFO [org.jboss.as.server] (DeploymentScanner-threads – 1) JBAS018559: Deployed “YOURWARNAME.war”

Copy your bpmn file to the right place. Right place you can find from jbpm-installer build.xml ( -Djbpm.console.directory )
cat build.xml | grep “Djbpm.console.directory”
in my case cp ../../Documents/workspace/drools_process_hello_world/src/main/java/com/sample2/DemoProcess.bpmn ./sample/evaluation/src/main/resources/ – Tegelikult piisab protsessi alustamiseks JBPM serveris (GUI http://127.0.0.1:8080/jbpm-console) ainult bpmn faili kopeerimisest.

ant stop.demo
ant start.demo

login your jbpm-console/ and open Process Overview -> Refresh and you will (if all previous steps are correct) your new process.

Start it.

 

 

Screen Shot 2013-02-05 at 5.15.48 PM

 

My process is very simpel. Only prints text to console.
Screen Shot 2013-02-05 at 5.16.00 PM

Screen Shot 2013-02-05 at 5.16.33 PM

Kui tegu on human taskiga, siis peaks saama protsessi käivitada ja jbpm-console peal nägema, et protsess käib.

Lisaks, kui task in/out actionisse on kirjutatud debug – System.out.println(“mingi debug infi”); siis peaks ka see olema näha jboss serveri logis.

Screen Shot 2013-02-07 at 9.21.11 PM