Hi everyone! I am back to the blog.
Recently I have done some work installing jbpm installer into tomcat again. It took me much less time that the first time :), but this time I decided to automate it, by patching the jbpm 5.1 full installer.First, let me review the steps I followed to deploy the jbpm installer tools in Tomcat 6:
1.
We need a JPA transaction manager to manage our jbpm runtime resources. So, let’s install Bitronix Transaction Manager in tomcat.
First, create btm-config.properties in tomcat.home/conf:
bitronix.tm.serverId=tomcat-btm-node0
bitronix.tm.journal.disk.logPart1Filename=${btm.root}/work/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=${btm.root}/work/btm2.tlog
bitronix.tm.resource.configuration=${btm.root}/conf/resources.properties
2.
Create resources.properties in tomcat.home/conf, which will have the resources that the transaction manager will manage.
resource.ds1.className=org.h2.jdbcx.JdbcDataSource
resource.ds1.uniqueName=jdbc/testDS1
resource.ds1.minPoolSize=0
resource.ds1.maxPoolSize=5
resource.ds1.driverProperties.URL=jdbc:h2:tcp://localhost/~/test
resource.ds1.driverProperties.user=sa
resource.ds1.driverProperties.password=
resource.ds1.allowLocalTransactions=true
3.
In tomcat.home/conf/context.xml, add this line
WEB-INF/web.xml <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />
4.
In tomcat.conf/conf/server.xml, add this line
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />
5.
Create setenv.sh (or setenv.bat if using windows), with the following:
CATALINA_OPTS=”-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties”This file will be executed by catalina.shwhen starting tomcat
6.
Copy the following jars to tomcat.home/lib
btm-2.1.2.jar
btm-tomcat55-lifecycle-2.1.2.jar
dom4j.jar
ejb3-persistence.jar
h2.jar
javassist.jar
jta-1.1.jar
slf4j-api-1.6.0.jar
slf4j-jdk14-1.6.0.jar
You can take (apart from the two btm jars) the jars from the jboss as installation from the installer.
7.Explode gwt console server, and add a file called context.xml in META-INF/ with the following:
<?xml version="1.0" encoding="UTF-8"?> <Context> <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/testDS1" auth="Container" type="javax.sql.DataSource" factory="bitronix.tm.resource.ResourceObjectFactory" uniqueName="jdbc/testDS1" /> </Context>
8.
Modify web.xml in gwt console server, adding the following:
<resource-env-ref> <resource-env-ref-name>jdbc/testDS1</resource-env-ref-name> <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type> </resource-env-ref>
9.
Modify WEB-INF/classes/META-INF/persistence.xml in gwt console server to look like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:comp/env/jdbc/testDS1</jta-data-source> <mapping-file>META-INF/JBPMorm.xml</mapping-file> <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class> <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class> <class>org.drools.persistence.info.SessionInfo</class> <class>org.drools.persistence.info.WorkItemInfo</class> <class>org.jbpm.process.audit.ProcessInstanceLog</class> <class>org.jbpm.process.audit.NodeInstanceLog</class> <class>org.jbpm.process.audit.VariableInstanceLog</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.hbm2ddl.auto" value="create" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" /> </properties> </persistence-unit> </persistence>
10.
Add the following jars (taken from jboss as lib) to WEB-INF/lib in gwt console server:
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-entitymanager.jar
11.
Now, in exploded designer war, add the following jars (taken from jboss as lib) to WEB-INF/lib
antlr.jar
log4j-boot.jar
12.
Put the exploded wars in tomcat.home/webapps
13.
Start tomcat!
I have developed a patched version of installer to make it all for you:
https://rapidshare.com/files/3915421953/jbpm5.1.tomcat6.rar
Steps:
- Download jbpm full installer.
- Unzip it in some place
- Overwrite build.xml and build.properties with the given ones.
- Put extra folder insode jbpm-installer folder.
- Run ant install.demo.noeclipse
- Run ant start.demo
- Gwt console will start in http://localhost:8080/gwt-console (user krisv/krisv, mary/mary, tomcat/tomcat, you can edit it in tomcat-users.xml file).
- Guvnor will start in http://localhost:8080/drools-guvnor/
Hope this helps you!
Demian
PS: I will give 5.2 a try this week and update instructions if necessary!