The following details how to install jBPM 5.2 onto Tomcat 7, configured to run the provided ‘Demo’. A H2 database instance shall be used – which is reflected in the JTA / Hibernate configuration specified below. The following are assumed installed and relatively clean:

NB: Tomcat should be stopped prior to installation.

0: Download required software:

JBPM : Select 5.2.0 – Final Installer Full

Once downloaded, unzip to a staging area separate from Tomcat – subsequent actions below will take place within the ‘jbpm-install’ folder.

1: Pre-Installation Configuration of Tomcat: Prepare for J2EE

It should be understood that Tomcat is not a J2EE application server – but rather a servlet container.

However – Tomcat can be made to behave like a J2EE application server.

In order to make this so, J2EE components need to be installed and configured on Tomcat.

For JBPM this is an apriori requirement. The steps below shall add the following J2EE services to Tomcat:

  • JTA (Java Transaction API)
  • Bitronix 2.1.3 Transaction Manager
  • JMS
  • JACC

a) In jbpm-install create folder: tomcat2j2ee \

b) In jbpm-install\tomcat2j2ee create the following files:

ivy.xml

<ivy-module version="2.0">
<info organisation="jbpm" module="btm" />
<dependencies>
    <dependency org="org.codehaus.btm" name="btm-dist" rev="2.1.3" />
     <dependency org="org.codehaus.btm" name="btm" rev="2.1.3">
          <artifact name="btm" type="jar" />
     </dependency>

     <dependency org="javax.transaction" name="jta" rev="1.1">
          <artifact name="jta" type="jar" />
     </dependency>
     
    <dependency org="org.apache.geronimo.specs" name="geronimo-jacc_1.1_spec" rev="1.0.2" >
          <artifact name="geronimo-jacc_1.1_spec" type="jar" />
     </dependency>
    </dependencies>
</ivy-module>

build.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="J2EE.install">

  <property name="install.home" value="./" />

  <property environment="env"/>
  <property name="tomcat.home" value="${env.CATALINA_HOME}"/>  
  <property name="tomcat.7.server.lib.dir" value="${tomcat.home}/lib" />

  <!-- ############ TOP LEVEL INSTALLATION ########### -->
  <target name="install.j2ee.to.tomcat.7" depends="download.j2ee">
     <copy todir="${tomcat.7.server.lib.dir}/">
         <fileset dir="${install.home}/lib" includes="*.jar" />
    </copy>
  </target>

  <target name="download.j2ee.check">
    <echo message="Checking J2EE Download..." />
     <condition property="btm.not.available">
       <not>
         <available file="${install.home}/lib/btm-2.1.3.jar" />
       </not>
     </condition>
  </target>
  <target name="download.j2ee" depends="download.j2ee.check" if="btm.not.available">
    <echo message="Getting J2EE..." />
     <mkdir dir="${install.home}/lib"/>
     <ivy:retrieve />  
  </target>
  
</project>

c) In jbpm-install\tomcat2j2ee execute:

ant install.j2ee.to.tomcat.7

d) Create the following file in ${CATALINA_HOME}\conf

btm-config.properties

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

NB: The following option may also be of use for test / dev purposes:

bitronix.tm.2pc.debugZeroResourceTransactions=true

e) Add the following parameters to $CATALINA_OPTS – such that they are passed to JVM when Tomcat starts:

-Dbtm.root=${CATALINA_HOME}
-Dbitronix.tm.configuration=${CATALINA_HOME}/conf/btm-config.properties

NB: On windows do this through the configuration tool – do not set environment variable unless you understand the implications.

You will need to specify ${CATALINA_HOME} in full rather than using environment variable.

You should now have a Tomcat 7 installation with J2EE services required for JBPM present.

2: Installation JBPM 5.3 : Pre-Configuration

The installation process for JBPM 5.3 shall be presented in script form below.

Before that step though it is required to create and perform some initial configuration of both JBPM and Tomcat.

a) Configuration of Tomcat

i) Reconfigure ${CATALINA_HOME}/server.xml

Add following entries to ${CATALINA_HOME}/server.xml after the server entry for: org.apache.catalina.core.JreMemoryLeakPreventionListener

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />

Add the following entries to the section: <GlobalNamingResources>

<Resource name="jdbc/testDS1" uniqueName="jdbc/testDS1" auth="Container" removeAbandoned="true" factory="bitronix.tm.resource.ResourceObjectFactory" type="javax.sql.DataSource" /> <Resource name="jta/UserTransaction" auth="Container" type="javax.transaction.UserTransaction" factory="bitronix.tm.BitronixUserTransactionObjectFactory" /> <Resource name="TransactionManager" auth="Container" type="javax.transaction.TransactionManager" factory="bitronix.tm.BitronixTransactionManagerObjectFactory" /> <Resource name="TransactionSynchronizationRegistry" auth="Container" type="javax.transaction.TransactionSynchronizationRegistry" factory="bitronix.tm.BitronixTransactionSynchronizationRegistryObjectFactory" /> <Resource name="jdbc/testDS1NonBTM"

uniqueName="jdbc/testDS1NonBTM"

auth="Container"

removeAbandoned="true"

type="javax.sql.DataSource"

scope="Shareable"

maxActive="100"

maxIdle="30"

username="sa"

password=""

driverClassName="org.h2.driver"

url="jdbc:h2:tcp://localhost/~/test"/>

ii) Reconfigure ${CATALINA_HOME}/context.xml

Add the following entries to context.xml after ‘WatchedResource’:

<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" /> <!-- To make java:comp/env/testDS1 available for reports - via jdbc/testDS1 --> <ResourceLink global="jdbc/testDS1" name="jdbc/testDS1" type="javax.sql.DataSource" />

<!-- To make java:comp/env/testDS1NonBTM available for the console - Non Transactional --> <ResourceLink global="jdbc/testDS1NonBTM" name="jdbc/testDS1NonBTM" type="javax.sql.DataSource" />

NB: The Birt reporting by default will use Tomcat JNDI to look up resources.

The global resources defined in server.xml in terms of Bitronix JNDI are aliased to Tomcat’s JNDI using resourcelink’s above.

The hibernate configuration (below…) uses a mix of Bitronix and non Bitronix. The Console uses a non transaction managed connection, the console-server does though.

b) Configuration of JBPM

i) Create the following files in: jbpm-install\db

resources.properties

resource.ds1.className=bitronix.tm.resource.jdbc.lrc.LrcXADataSource resource.ds1.uniqueName=jdbc/testDS1 resource.ds1.minPoolSize=0 resource.ds1.maxPoolSize=5 resource.ds1.driverProperties.driverClassName=org.h2.Driver resource.ds1.driverProperties.url=jdbc:h2:tcp://localhost/~/test resource.ds1.driverProperties.user=sa resource.ds1.driverProperties.password=

resource.ds1.allowLocalTransactions=true resource.ds1.testQuery=SELECT 1+1

persistence.xml

<?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.drools.persistence.info.WorkItemInfo</class>

<class>org.drools.persistence.info.SessionInfo</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.current_session_context_class" value="jta" />

<property name="hibernate.transaction.fatory_class" value="org.hibernate.transaction.JTATransactionFactory" />

<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />

<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />

<property name="hibernate.cache.use_second_level_cache" value="false" />

<property name="hibernate.max_fetch_depth" value="3"/>

<property name="hibernate.hbm2ddl.auto" value="update" />

<property name="hibernate.show_sql" value="false" />

</properties>

</persistence-unit>

</persistence>

hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- The following is explicitly not using JTA -->

<!-- Direct - JNDI - Not BTM -->

<property name="connection.datasource">java:comp/env/jdbc/testDS1NonBTM</property>

<property name="current_session_context_class">thread</property>

<!-- Direct - Non JNDI -->

<!--

<property name="connection.driver_class">org.h2.Driver</property>

<property name="connection.url">jdbc:h2:tcp://localhost/~/test</property>

<property name="connection.username">sa</property>

<property name="connection.password"></property>

<property name="current_session_context_class">thread</property>

-->

<!-- The following is JTA version using Bitronix jndi / pool / transaction management -->

<!--

<property name="jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/> <property name="hibernate.jndi.java.naming.factory.initial" value="bitronix.tm.jndi.BitronixInitialContextFactory" />

<property name="transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />

<property name="current_session_context_class">jta</property>

<property name="jta.userTransaction">java:comp/UserTransaction</property>

<property name="transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />

<property name="connection.datasource" value="jdbc/testDS1" />

-->

<property name="dialect">org.hibernate.dialect.H2Dialect</property>

<property name="max_fetch_depth">3</property>

<!-- JDBC connection pool (use the built-in) -->

<property name="connection.pool_size">1</property>

<!-- Disable the second-level cache -->

<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<property name="show_sql">false</property>

<property name="hbm2ddl.auto">update</property>

<mapping resource="AuditLog.hbm.xml"/>

</session-factory>

</hibernate-configuration>

persistence-human-task-service.xml

<?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.task">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<mapping-file>META-INF/Taskorm.xml</mapping-file>

<class>org.jbpm.task.Attachment</class>

<class>org.jbpm.task.Content</class>

<class>org.jbpm.task.BooleanExpression</class>

<class>org.jbpm.task.Comment</class>

<class>org.jbpm.task.Deadline</class>

<class>org.jbpm.task.Comment</class>

<class>org.jbpm.task.Deadline</class>

<class>org.jbpm.task.Delegation</class>

<class>org.jbpm.task.Escalation</class>

<class>org.jbpm.task.Group</class>

<class>org.jbpm.task.I18NText</class>

<class>org.jbpm.task.Notification</class>

<class>org.jbpm.task.EmailNotification</class>

<class>org.jbpm.task.EmailNotificationHeader</class>

<class>org.jbpm.task.PeopleAssignments</class>

<class>org.jbpm.task.Reassignment</class>

<class>org.jbpm.task.Status</class>

<class>org.jbpm.task.Task</class>

<class>org.jbpm.task.TaskData</class>

<class>org.jbpm.task.SubTasksStrategy</class>

<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>

<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>

<class>org.jbpm.task.User</class>

<properties>

<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>

<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>

<property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/~/test" />

<property name="hibernate.connection.username" value="sa"/>

<property name="hibernate.connection.password" value=""/>

<property name="hibernate.connection.autocommit" value="true" />

<property name="hibernate.max_fetch_depth" value="3"/>

<property name="hibernate.hbm2ddl.auto" value="create" />

<property name="hibernate.show_sql" value="false" />

</properties>

</persistence-unit>

</persistence>

NB: The above configurations will make use of H2 backend database – data sources are configured through JNDI using Bitronix as initial context.

Bitronix / JTA is not used in the hibernate.cfg.xml above: This configuration is used during interaction between the console and console- server.

Checkpoint: We have at this point installed required J2EE services to Tomcat, configured JNDI datasource components for JPBM on Tomcat and prepared a configuration of JPBM 5.2 to be installed.

The next step is to perform the JBPM installation to Tomcat.

3: Installation JBPM 5.2

a) Add the following to the end of: jbpm-install\build.properties

# Tomcat Server Version
tomcat.server.version=7
# Database Parameters
# H2
h2.jdbc.driver.version=1.2.124
# Defines MySQL Connect JDBC Driver to Use
mysql.jdbc.driver.version=5.1.20

b) Create the following files in jbpm-install:

ivy.xml

<ivy-module version="2.0">
<info organisation="jbpm" module="btm" />
<dependencies>     
     <dependency org="javassist" name="javassist" rev="3.4.GA">
          <artifact name="javassist" type="jar" />
     </dependency>
</dependencies>
</ivy-module>

tomcat7build.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="jBPM.install">

<property file="build.properties" />

<property name="install.home" value="./" />

<property environment="env"/>

<property name="tomcat.home" value="${env.CATALINA_HOME}"/>

<property name="tomcat.7.server.conf.dir" value="${tomcat.home}/conf" />

<property name="tomcat.7.server.lib.dir" value="${tomcat.home}/lib" />

<property name="tomcat.7.server.deploy.dir" value="${tomcat.home}/webapps" />

<property name="tomcat.bind.address" value="localhost" />

<property name="h2.jdbc.jar" value="h2-${h2.jdbc.driver.version}.jar" />

<property name="h2.download.url" value="http://repo1.maven.org/maven2/com/h2database/h2/${h2.jdbc.driver.version}/${h2.jdbc.jar}"/>

<property name="mysql.jdbc.jar" value="mysql-connector-java-${mysql.jdbc.driver.version}.jar" />

<property name="mysql.download.url" value="http://repo1.maven.org/maven2/mysql/mysql-connector-java/${mysql.jdbc.driver.version}/${mysql.jdbc.jar}"/>

<property name="birt.version.as7" value="3_7_0"/>

<property name="birt.download.url.as7" value="http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-3_7_0-201106151818/birt-runtime-3_7_0.zip&amp;url=http://download.eclipse.org/birt/downloads/drops/R-R1-3_7_0-201106151818/birt-runtime-3_7_0.zip&amp;mirror_id=1"/>

<!-- ############ TOP LEVEL INSTALLATION ########### -->

<target name="install.jbpmfull.to.tomcat.7">

<antcall target="download.dependencies" />

<antcall target="install.bitronix.config.into.tomcat.7" />

<antcall target="install.jBPM.into.tomcat.7" />

<antcall target="install.guvnor.into.tomcat.7" />

<antcall target="install.designer.into.tomcat.7" />

</target>

<target name="start.demo">

<antcall target="install.jBPM.runtime" />

<antcall target="start.human.task" />

</target>

<target name="install.jbpmfull.config.only.to.tomcat.7" >

<antcall target="install.bitronix.config.into.tomcat.7" />

<antcall target="install.gwtconsoleserver.config.into.tomcat.7" />

</target>

<!-- ############ TOMCAT SUPPORT ########### -->

<target name="check.tomcat.version">

<condition property="tomcat.version.is.7">

<equals arg1="${tomcat.server.version}" arg2="7" />

</condition>

</target>

<!-- ############ DOWNLOAD ############ -->

<!-- Dependencies -->

<target name="download.dependencies">

<echo message="Getting Dependencies ..." />

<mkdir dir="${install.home}/lib"/>

<ivy:retrieve />

</target>

<!-- Databases -->

<!-- Download H2 -->

<target name="download.h2.check">

<echo message="Checking H2 download ..." />

<condition property="h2.not.available">

<not>

<available file="${install.home}/db/driver/${h2.jdbc.jar}" />

</not>

</condition>

</target>

<target name="download.h2" depends="download.h2.check" if="h2.not.available">

<echo message="Getting H2..." />

<mkdir dir="${install.home}/db/driver"/>

<get src="${h2.download.url}" dest="${install.home}/db/driver/${h2.jdbc.jar}" />

</target>

<!-- Download MySQL -->

<target name="download.mysql.check">

<echo message="Checking MySql download..." />

<condition property="mysql.not.available">

<not>

<available file="${install.home}/db/driver/${mysql.jdbc.jar}" />

</not>

</condition>

</target>

<target name="download.mysql" depends="download.mysql.check" if="mysql.not.available">

<echo message="Getting MySql ..." />

<mkdir dir="${install.home}/db/driver"/>

<get src="${mysql.download.url}" dest="${install.home}/db/driver/${mysql.jdbc.jar}" />

</target>

<!-- Download jBPM binaries -->

<target name="download.jBPM.bin.check">

<echo message="Checking jBPM binaries download ..." />

<condition property="jBPM.bin.not.available">

<not>

<available file="${install.home}/lib/jbpm-${jBPM.version}-bin.zip" />

</not>

</condition>

</target>

<target name="download.jBPM.bin" depends="download.jBPM.bin.check" if="jBPM.bin.not.available">

<echo message="Getting jBPM binaries ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${jBPM.url}/jbpm-${jBPM.version}-bin.zip" dest="${install.home}/lib/jbpm-${jBPM.version}-bin.zip" />

</target>

<!-- Download Drools Guvnor -->

<target name="download.drools.guvnor.check">

<echo message="Checking Drools Guvnor download ..." />

<condition property="drools.guvnor.not.available">

<not>

<available file="${install.home}/lib/guvnor-distribution-wars-${drools.guvnor.version}.war" />

</not>

</condition>

</target>

<target name="download.drools.guvnor" depends="download.drools.guvnor.check" if="drools.guvnor.not.available">

<echo message="Getting Drools Guvnor ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${drools.guvnor.url}" dest="${install.home}/lib/guvnor-distribution-wars-${drools.guvnor.version}.war"/>

</target>

<!-- Download Designer -->

<target name="download.designer.check">

<echo message="Checking Designer download ..." />

<condition property="designer.not.available">

<not>

<available file="${install.home}/lib/designer-${designer.version}.war" />

</not>

</condition>

</target>

<target name="download.designer" depends="download.designer.check" if="designer.not.available">

<echo message="Getting Designer ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${designer.url}/designer-${designer.version}.war" dest="${install.home}/lib/designer-${designer.version}.war" />

</target>

<!-- Download form builder -->

<target name="download.form.builder.check">

<echo message="Checking Form Builder download ..." />

<condition property="form.builder.not.available">

<not>

<available file="${install.home}/lib/jbpm-${jBPM.version}-form-builder.war" />

</not>

</condition>

</target>

<target name="download.form.builder" depends="download.form.builder.check" if="form.builder.not.available">

<echo message="Getting Form Builder ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${form.builder.url}" dest="${install.home}/lib/jbpm-${jBPM.version}-form-builder.war" />

</target>

<!-- Download jBPM gwt-console -->

<target name="download.jBPM.gwt-console.check">

<echo message="Checking jBPM gwt-console download ..." />

<condition property="jBPM.gwt-console.not.available">

<not>

<available file="${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip" />

</not>

</condition>

</target>

<target name="download.jBPM.gwt-console" depends="download.jBPM.gwt-console.check" if="jBPM.gwt-console.not.available">

<echo message="Getting jBPM gwt-console ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${jBPM.url}/jbpm-${jBPM.version}-gwt-console.zip" dest="${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip" />

</target>

<!-- Download BIRT engine for AS7 -->

<target name="check.birt.as7">

<condition property="birt.download">

<equals arg1="${jBPM.birt.download}" arg2="true" />

</condition>

</target>

<target name="download.birt.check.as7" depends="check.birt.as7" if="birt.download">

<echo message="Checking birt reporting engine download for as7 ..." />

<condition property="birt.not.available">

<not>

<available file="${install.home}/lib/birt-runtime-${birt.version.as7}.zip" />

</not>

</condition>

</target>

<target name="download.birt.as7" depends="download.birt.check.as7" if="birt.not.available">

<echo message="Getting birt reporting engine for AS7 ..." />

<mkdir dir="${install.home}/lib"/>

<get src="${birt.download.url.as7}" dest="${install.home}/lib/birt-runtime-${birt.version.as7}.zip" />

</target>

<!-- ############ INSTALL ############ -->

<!-- Install Bitronix -->

<target name="install.bitronix.config.into.tomcat.7">

<copy todir="${tomcat.7.server.conf.dir}"

file="${install.home}/db/resources.properties"

overwrite="true" />

</target>

<!-- Install gtw-console-server config -->

<target name="install.gwtconsoleserver.config.into.tomcat.7">

<copy todir="${tomcat.7.server.deploy.dir}/gwt-console-server/WEB-INF/classes"

file="${install.home}/db/hibernate.cfg.xml"

overwrite="true" />

<copy todir="${tomcat.7.server.deploy.dir}/gwt-console-server/WEB-INF/classes/META-INF"

file="${install.home}/db/persistence.xml"

overwrite="true" />

</target>

<!-- Install JDBC -->

<target name="install.h2.into.tomcat.7" depends="download.h2,check.tomcat.version">

<copy todir="${tomcat.7.server.lib.dir}"

file="${install.home}/db/driver/${h2.jdbc.jar}"

overwrite="true" />

</target>

<target name="install.mysql.into.tomcat.7" depends="download.mysql,check.tomcat.version">

<copy todir="${tomcat.7.server.lib.dir}"

file="${install.home}/db/driver/${mysql.jdbc.jar}"

overwrite="true" />

</target>

<!-- Install guvnor -->

<target name="install.guvnor.into.tomcat.7" depends="download.drools.guvnor,check.tomcat.version">

<mkdir dir="${install.home}/target"/>

<mkdir dir="${install.home}/target/jbpm-drools-guvnor-war"/>

<unzip src="${install.home}/lib/guvnor-distribution-wars-${drools.guvnor.version}.war"

dest="${install.home}/target/jbpm-drools-guvnor-war" />

<!-- Fixes for Tomcat... -->

<delete file="${install.home}/target/jbpm-drools-guvnor-war/WEB-INF/lib/servlet-api-2.5.jar"/>

<zip basedir="${install.home}/target/jbpm-drools-guvnor-war"

destfile="${install.home}/target/guvnor-distribution-wars-${drools.guvnor.version}.war" />

<copy file="${install.home}/target/guvnor-distribution-wars-${drools.guvnor.version}.war"

tofile="${tomcat.7.server.deploy.dir}/drools-guvnor.war"

overwrite="true" />

<delete dir="${install.home}/target"/>

</target>

<!-- Install designer -->

<target name="install.designer.into.tomcat.7" depends="download.designer,check.tomcat.version">

<copy file="${install.home}/lib/designer-${designer.version}.war"

tofile="${tomcat.7.server.deploy.dir}/designer.war"

overwrite="true" />

</target>

<!-- Install gwt-console -->

<target name="install.jBPM.into.tomcat.7" depends="download.mysql,download.h2,download.jBPM.gwt-console" >

<antcall target="install.mysql.into.tomcat.7" />

<antcall target="install.h2.into.tomcat.7" />

<mkdir dir="${install.home}/target"/>

<unzip src="${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip"

dest="${install.home}/target/" />

<antcall target="install.jBPM-gwt-console.into.tomcat.7" />

<antcall target="install.jBPM-gwt-console-server.into.tomcat.7" />

<delete dir="${install.home}/target"/>

</target>


<target name="install.jBPM-gwt-console.into.tomcat.7" depends="check.tomcat.version" if="tomcat.version.is.7">

<!-- gwt-console -->

<unzip src="${install.home}/target/jbpm-gwt-console-${jBPM.version}.war"

dest="${install.home}/target/jbpm-gwt-console-war"/>



<!-- Fix for conflicting javassist jar -->

<delete file="${install.home}/target/jbpm-gwt-console-war/WEB-INF/lib/javassist-3.6.0.GA.jar"/>

<!-- Further fixes for Tomcat... -->

<delete file="${install.home}/target/jbpm-gwt-console-war/WEB-INF/lib/jta-1.1.jar"/>

<delete file="${install.home}/target/jbpm-gwt-console-war/WEB-INF/lib/dom4j-1.6.jar"/>

<copy todir="${install.home}/target/jbpm-gwt-console-war/WEB-INF/lib"

file="${install.home}/lib/javassist-3.4.GA.jar"

overwrite="true" />

<!-- Repackage WAR and deploy -->

<zip basedir="${install.home}/target/jbpm-gwt-console-war"

destfile="${install.home}/target/jbpm-gwt-console-${jBPM.version}.war"/>

<copy file="${install.home}/target/jbpm-gwt-console-${jBPM.version}.war"

tofile="${tomcat.7.server.deploy.dir}/jbpm-console.war"

overwrite="true" />

</target>


<!-- Install gwt-console-server -->

<target name="install.jBPM-gwt-console-server.into.tomcat.7" depends="check.tomcat.version" if="tomcat.version.is.7">

<!-- reporting -->

<antcall target="download.birt.as7" />

<!-- gwt-console-server -->

<unzip src="${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war"

dest="${install.home}/target/jbpm-gwt-console-server-war"/>

<copy file="${install.home}/db/hibernate.cfg.xml"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/hibernate.cfg.xml"

overwrite="true" />

<copy file="${install.home}/db/persistence.xml"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/META-INF/persistence.xml"

overwrite="true" />

<copy file="${install.home}/auth/users.properties"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/users.properties"

overwrite="true" />

<copy file="${install.home}/auth/roles.properties"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/roles.properties"

overwrite="true" />

<copy file="${install.home}/jbpm-tm.jar"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/jbpm-tm.jar"

overwrite="true" />

<!-- Fix for conflicting javassist jar -->

<delete file="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/javassist-3.6.0.GA.jar"/>

<delete file="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/javassist-3.14.0-GA.jar" />

<copy todir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib"

file="${install.home}/lib/javassist-3.4.GA.jar"

overwrite="true" />

<!-- Further fixes for Tomcat... -->

<delete file="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/el-api-1.2.jar"/>

<delete file="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/dom4j-1.6.jar"/>

<!-- Other configuration like work item handlers -->

<copy todir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes" overwrite="true">

<fileset dir="${install.home}/conf"/>

</copy>

<!-- reporting -->

<antcall target="install.reporting.into.tomcat.7" />

<zip basedir="${install.home}/target/jbpm-gwt-console-server-war"

destfile="${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war"/>

<copy file="${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war"

tofile="${tomcat.7.server.deploy.dir}/gwt-console-server.war"

overwrite="true" />

</target>

<!-- Install reporting Tomcat7 -->

<target name="install.reporting.into.tomcat.7" depends="check.birt.as7" if="birt.download" >

<mkdir dir="${install.home}/birt"/>

<unzip src="${install.home}/lib/birt-runtime-${birt.version.as7}.zip"

dest="${install.home}/birt"/>

<copy todir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib">

<fileset dir="${install.home}/birt/birt-runtime-${birt.version.as7}/ReportEngine/lib">

<include name="**/*.jar"/>

</fileset>

</copy>

<mkdir dir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/output"/>

<mkdir dir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/output/image"/>

<mkdir dir="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/reports"/>

<copy file="${install.home}/report/${birt.version.as7}/overall_activity.rptdesign"

tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/reports/overall_activity.rptdesign"

overwrite="true"/>

<delete dir="${install.home}/birt"/>

</target>


<!-- Install Demo -->


<!-- create runtime -->

<target name="install.jBPM.runtime" depends="download.jBPM.bin">

<mkdir dir="${install.home}/runtime"/>

<unzip src="${install.home}/lib/jbpm-${jBPM.version}-bin.zip" dest="${install.home}/runtime" />

</target>



<path id="classpath.human.task">

<fileset dir="${install.home}/runtime" includes="**/*.jar"/>

<fileset dir="${install.home}/db/driver" includes="**/*.jar"/>

</path>

<target name="start.human.task">

<mkdir dir="${install.home}/task-service/target"/>

<javac includeantruntime="false" srcdir="${install.home}/task-service/src" destdir="${install.home}/task-service/target" classpathref="classpath.human.task">

<compilerarg value="-Xlint:unchecked"/>

</javac>

<copy tofile="${install.home}/task-service/resources/META-INF/persistence.xml"

file="${install.home}/db/persistence-human-task-service.xml"

overwrite="true" />

<copy todir="${install.home}/task-service/target">

<fileset dir="${install.home}/task-service/resources"/>

</copy>

<java classname="org.jbpm.DemoTaskService" fork="true">

<classpath>

<pathelement path="${install.home}/task-service/target"/>

<path refid="classpath.human.task" />

</classpath>

</java>

</target>

</project>

c) Perform the installation: In jbpm-install execute:

ant -buildfile tomcat7build.xml install.jbpmfull.to.tomcat.7

d) Add the following parameters to $CATALINA_OPTS and passed to JVM when Tomcat started:

-Xms256m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=256m
-Dreporting.needcontext=true

NB: On windows do this through the configuration tool – do not set environment variable unless you understand the implications.

Checkpoint: We have at this point installed JBPM 5.2 to Tomcat.

4: Running the Demo

a) Update report definition: ${CATALINA_HOME}/webapps/gwt-console-server/WEB-INF/reports/overall_activity.rptdesign

Add following to ‘oda-data-source’ section:

<property name="odaJndiName">java:comp/env/jdbc/testDS1</property>

b) Add following to Tomcat startup parameter:

-Djbpm.console.directory=\sample\evaluation\src\main\resources

c) Reconfigure ${CATALINA_HOME}/tomcat-users.xml, add:

<role rolename="manager" />
<role rolename="admin" />
<role rolename="user" />
<role rolename="PM" />
<role rolename="HR" />
<role rolename="webdesigner" />
<role rolename="functionalanalyst" />
<role rolename="sales" />
<user username="krisv" password="krisv" roles="manager,admin,user" />
<user username="john" password="john" roles="admin,manager,user,PM" />
<user username="mary" password="mary" roles="admin,manager,user,HR" />
<user username="sales-rep" password="sales-rep" roles="admin,manager,user,sales" />
<user username="admin" password="admin" roles="admin,manager,user,webdesigner,functionalanalyst" />

e) Start H2: In jbpm-install execute:

ant start.h2

f) Start The Human Task Service: In jbpm-install execute:

ant -tomcat7demo start.demo

g) Start Tomcat

h) Naviate to: http://localhost:8080/jbpm-console

Trouble Shooting

  • Ant warning when launching human task: ‘warning: ‘includeantruntime’ was not set’

Edit jbpm-installer/build.xml and add following attribute to the start.human.task target javac directive:

includeantruntime=”false”

For more details see: http://stackoverflow.com/questions/5103384/ant-warning-includeantruntime-was-not-set

  • Confirm H2 database initialized

The H2 database should be initialized with demo user details once the human task engine has been started (assuming H2 is running).

H2 default port is: 9092

Connect using SQL interface (eg. Squirrel) and check that schema TEST exists. There should be several tables, ORGANIZATIONALENTITY should have entries.

  • Error is received in jbpm-console indicating EOFException has occurred

This is most likely due to corruption of the persistence work files.

To repair, stop Tomcat and delete ${CATALINA_HOME}/work

  • Report Engine fails indicating IllegalAccessException – report server not initialized

Assuming step 7 above has been completed, ensure that the reporting.needcontext parameter has been passed to Tomcat runtime at startup – see 7E above.

Additional Links / Resources

BIRT Homepage

http://www.eclipse.org/birt/phoenix/ Hibernate

Advertisements