[jboss-user] [jBPM] - JBPM 5.3 / Tomcat 7 / H2 / Demo

smclenahan do-not-reply at jboss.com
Tue Jun 26 11:53:57 EDT 2012


smclenahan [https://community.jboss.org/people/smclenahan] modified the document:

"JBPM 5.3 / Tomcat 7 / H2 / Demo"

To view the document, visit: https://community.jboss.org/docs/DOC-18626

--------------------------------------------------------------
  The following details how to install jBPM 5.3 onto Tomcat 7, configured to run the provided 'Demo'.  A  http://www.h2database.com/html/main.html H2 database instance shall be used - which is reflected in the JTA / Hibernate configuration specified below.  The following are assumed installed and relatively clean: 
*  http://tomcat.apache.org/download-70.cgi Tomcat 7.0 (on port 8080)
*  http://ant.apache.org/ Ant 1.8.3
*  http://ant.apache.org/ivy/ Apache Ivy 2.0
*NB:* Tomcat should be stopped prior to installation.  

*0: Download required software:*
 http://www.jboss.org/jbpm JBPM : Select  http://sourceforge.net/projects/jbpm/files/ 5.3.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: 
<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" />

*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" /> 
<ResourceLink global="jta/UserTransaction" name="UserTransaction" type="javax.transaction.UserTransaction" />
<Transaction factory="bitronix.tm.BitronixTransactionSynchronizationRegistryObjectFactory" jotm.timeout="60"/>

 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 the Bitronix JNDI references  

*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>
    <mapping-file>META-INF/ProcessInstanceInfo.hbm.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>

 *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="false" />
      <property name="hibernate.max_fetch_depth" value="3"/>
      <property name="hibernate.hbm2ddl.auto" value="update" />
      <property name="hibernate.show_sql" value="false" />      
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
    </properties>
  </persistence-unit>
</persistence>

 *persistence-human-task-war.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.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/>        
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
       <property name="hibernate.connection.datasource" value="jdbc/testDS1" />
       <property name="hibernate.max_fetch_depth" value="3"/>
      <property name="hibernate.hbm2ddl.auto" value="update" />
      <property name="hibernate.show_sql" value="false" />
      <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
    </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.  

*ii)* Create the following file in: jbpm-install\conf 

*web.humantaskwar.xml*
<web-app>
  <display-name>Human Task Service WAR</display-name>
  <servlet>
    <servlet-name>HumanTaskServiceServlet</servlet-name>
      <servlet-class>org.jbpm.task.servlet.HumanTaskServiceServlet</servlet-class>
      
      <!-- Following is a list of initialization parameters that HumanTaskService Servlet accepts
              Main controller is active.config parameter that dictates what transport to initialize.
              
              Then there are transport specific parameters that should be filled in only for selected
              transport.
              
              Last part provides access to configuring components of task Service itself. All of them
              are optional and in case there are not set default values will apply.
       -->
      
      <!-- active configuration on of hornetq|mina|jms (defauls to hornetq) -->
      <init-param>
           <param-name>active.config</param-name>
           <param-value>mina</param-value>
      </init-param>
      
      <!-- Apache Mina configuration parameters -->
      <init-param>
           <param-name>mina.host</param-name>
           <param-value>localhost</param-value>
      </init-param>
      <init-param>
           <param-name>mina.port</param-name>
           <param-value>9123</param-value>
      </init-param>
      
      <!-- HornetQ configuration parameters -->
      <init-param>
           <param-name>hornetq.port</param-name>
           <param-value></param-value>
      </init-param>
      
      <!-- JMS configuration parameters -->
      <init-param>
           <param-name>JMSTaskServer.connectionFactory</param-name>
           <param-value></param-value>
      </init-param>
      <init-param>
           <param-name>JMSTaskServer.transacted</param-name>
           <param-value></param-value>
      </init-param>
      <init-param>
           <param-name>JMSTaskServer.acknowledgeMode</param-name>
           <param-value></param-value>
      </init-param>
      <init-param>
           <param-name>JMSTaskServer.queueName</param-name>
           <param-value></param-value>
      </init-param>
      <init-param>
           <param-name>JMSTaskServer.responseQueueName</param-name>
           <param-value></param-value>
      </init-param>
      
      <!-- Task Service configuration independent of transport -->
      <init-param>
           <param-name>task.persistence.unit</param-name>
           <param-value>org.jbpm.task</param-value>
      </init-param>
      <!-- use org.jbpm.task.service.DefaultUserGroupCallbackImpl to configure sample user group callback for demo purpose-->
      <init-param>
           <param-name>user.group.callback.class</param-name>
           <param-value>org.jbpm.task.service.DefaultUserGroupCallbackImpl</param-value>
      </init-param>
      <init-param>
           <param-name>escalated.deadline.handler.class</param-name>
           <param-value></param-value>
      </init-param>
      <init-param>
           <param-name>user.info.class</param-name>
           <param-value></param-value>
      </init-param>
      <!-- allows to specify location of a files that will be used to initially populate task server db -->
      <!-- accepts two types of files: MVEL and properties must be suffixed with .mvel and .properties -->
      <!-- location of the files can be either on classpath (with prefix classpath:) or valid URL -->
      <!-- NOTE: that with custom users files Administrator user must always be present!!! -->
      <!-- use classpath:/org/jbpm/task/servlet/SampleUsers.mvel to configure sample users for demo purpose-->
      <!-- DefaultUsers.mvel is used to insert Administrator as it is required for task server to operate -->
      <init-param>
        <param-name>load.users</param-name>
        <param-value>classpath:/org/jbpm/task/servlet/DefaultUsers.mvel</param-value>
      </init-param>
      <!-- use classpath:/org/jbpm/task/servlet/SampleGroups.mvel to configure sample users for demo purpose-->
      <init-param>
        <param-name>load.groups</param-name>
        <param-value></param-value>
      </init-param>
      
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>HumanTaskServiceServlet</servlet-name>
    <url-pattern>/HumanTaskServiceServlet/*</url-pattern>
  </servlet-mapping>
</web-app>

 *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.3 to be installed.* 

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

*3: Installation JBPM 5.3* 

*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>
     <dependency org="org.jboss.weld.servlet" name="weld-servlet" rev="1.1.8.Final">
          <artifact name="weld-servlet" 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" />
     <antcall target="install.form.builder.into.tomcat.7" />
     <antcall target="install.ht.war.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" />
      <antcall target="install.humantaskwar.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 human task server war -->
  <target name="download.jBPM.ht-war.check">
    <echo message="Checking jBPM human task war download ..." />
    <condition property="jBPM.ht-war.not.available">
      <not>
        <available file="${install.home}/lib/jbpm-${jBPM.version}-human-task-war.zip" />
      </not>
    </condition>
  </target>
  <target name="download.jBPM-ht.war" depends="download.jBPM.ht-war.check" if="jBPM.ht-war.not.available">
    <echo message="Getting jBPM human task war ..." />
    <mkdir dir="${install.home}/lib"/>
    <get src="${jBPM.url}/jbpm-${jBPM.version}-human-task-war.zip" dest="${install.home}/lib/jbpm-${jBPM.version}-human-task-war.zip"  />
  </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 human-task-war config -->
  <target name="install.humantaskwar.config.into.tomcat.7"> 
    <copy file="${install.home}/conf/web.humantaskwar.xml" 
          tofile="${tomcat.7.server.deploy.dir}/jbpm-human-task-war/WEB-INF/web.xml" 
          overwrite="true" />
    <copy file="${install.home}/db/persistence-human-task-war.xml" 
          tofile="${tomcat.7.server.deploy.dir}/jbpm-human-task-war/WEB-INF/classes/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"/>

    <copy file="${install.home}/lib/weld-servlet-1.1.8.Final.jar"
          tofile="${install.home}/target/jbpm-drools-guvnor-war/WEB-INF/lib/weld-servlet-1.1.8.Final.jar"
          overwrite="true" />
          
       <antcall target="removeJavaxServletFromJar" >
          <param name="jarpath" value="${install.home}/target/jbpm-drools-guvnor-war/WEB-INF/lib" />
          <param name="jarname" value="jboss-servlet-api_3.0_spec-1.0.0.Final.jar" />
     </antcall>

       <antcall target="removeJavaxServletFromJar" >
          <param name="jarpath" value="${install.home}/target/jbpm-drools-guvnor-war/WEB-INF/lib" />
          <param name="jarname" value="gwt-user-2.3.0.jar" />
     </antcall>

    <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>       

  <target name="removeJavaxServletFromJar">
    <mkdir dir="${jarpath}/${jarname}.tmp" />
    <unzip src="${jarpath}/${jarname}"
            dest="${jarpath}/${jarname}.tmp" />
     <move file="${jarpath}/${jarname}" toFile="${jarpath}/${jarname}.orig" />
    <delete dir="${jarpath}/${jarname}.tmp/javax/servlet" />
    <zip basedir="${jarpath}/${jarname}.tmp"
         destfile="${jarpath}/${jarname}" />
    <delete dir="${jarpath}/${jarname}.tmp" />
  </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 form builder -->
  <target name="install.form.builder.into.tomcat.7" depends="download.form.builder">
    <mkdir dir="${install.home}/target"/>
    <mkdir dir="${install.home}/target/jbpm-form-builder-war"/>
    <unzip src="${install.home}/lib/jbpm-${jBPM.version}-form-builder.war" dest="${install.home}/target/jbpm-form-builder-war" />

    <copy file="${install.home}/auth/users.properties"
          tofile="${install.home}/target/jbpm-form-builder-war/WEB-INF/classes/users.properties" 
          overwrite="true" />
    <copy file="${install.home}/auth/roles.properties"
          tofile="${install.home}/target/jbpm-form-builder-war/WEB-INF/classes/roles.properties" 
          overwrite="true" />
    <copy file="${install.home}/auth/users.properties"
          tofile="${jboss.server.conf.dir}/users.properties" 
          overwrite="true" />
    <copy file="${install.home}/auth/roles.properties"
          tofile="${jboss.server.conf.dir}/roles.properties" 
          overwrite="true" />
            
    <zip basedir="${install.home}/target/jbpm-form-builder-war"
         destfile="${install.home}/target/jbpm-${jBPM.version}-form-builder.war" />
           
    <copy file="${install.home}/target/jbpm-${jBPM.version}-form-builder.war" 
          tofile="${tomcat.7.server.deploy.dir}/jbpm-form-builder.war" 
          overwrite="true" />
            
    <delete dir="${install.home}/target" />
  </target>
  
  <!-- Install jbpm human task war -->
  <target name="install.ht.war.into.tomcat.7" depends="download.jBPM-ht.war">
    <unzip src="${install.home}/lib/jbpm-${jBPM.version}-human-task-war.zip" dest="${install.home}/lib" />
    <mkdir dir="${install.home}/target"/>
    <mkdir dir="${install.home}/target/jbpm-human-task-war"/>
    <unzip src="${install.home}/lib/jbpm-human-task-war-${jBPM.version}.war" dest="${install.home}/target/jbpm-human-task-war" />

     <!-- Abstraction for Tomcat Install -->
       <copy file="${install.home}/conf/web.humantaskwar.xml" 
                 tofile="${install.home}/task-service/resources/war/web.xml" 
                 overwrite="true" />
       <copy file="${install.home}/db/persistence-human-task-war.xml" 
                 tofile="${install.home}/task-service/resources/war/persistence.xml" 
                 overwrite="true" />
     <!-- Now Proceed To patch the WAR... -->     
       <copy file="${install.home}/task-service/resources/war/web.xml" 
                 tofile="${install.home}/target/jbpm-human-task-war/WEB-INF/web.xml" 
                 overwrite="true" />
       <copy file="${install.home}/task-service/resources/war/persistence.xml" 
                     tofile="${install.home}/target/jbpm-human-task-war/WEB-INF/classes/META-INF/persistence.xml" 
                     overwrite="true" />
       <copy file="${install.home}/jbpm-tm.jar"
                 tofile="${install.home}/target/jbpm-human-task-war/WEB-INF/lib/jbpm-tm.jar"
                 overwrite="true" />
     <!-- Fix for Tomcat -->
    <delete file="${install.home}/target/jbpm-human-task-war/WEB-INF/lib/jta-1.1.jar"/>
     <delete file="${install.home}/target/jbpm-human-task-war/WEB-INF/lib/javassist-3.14.0-GA.jar" />

     <copy todir="${install.home}/target/jbpm-human-task-war/WEB-INF/lib/"
           file="${install.home}/lib/javassist-3.4.GA.jar"
            overwrite="true" />

     <!-- Rebuild the WAR and deploy -->
    <zip basedir="${install.home}/target/jbpm-human-task-war"
         destfile="${install.home}/target/jbpm-${jBPM.version}-human-task-war.war" />

     <copy file="${install.home}/target/jbpm-${jBPM.version}-human-task-war.war" 
          tofile="${tomcat.7.server.deploy.dir}/jbpm-human-task-war.war" 
          overwrite="true" />
            
    <delete dir="${install.home}/target" /> 
  </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"/>
        
    <!-- Tomcat Fix -->
     <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-gwt-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/persistence.xml"
          tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/META-INF/persistence.xml"
          overwrite="true" />
    <copy file="${install.home}/db/ProcessInstanceInfo.hbm.xml"
          tofile="${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/META-INF/ProcessInstanceInfo.hbm.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.3 to Tomcat.* 

*Before proceeding to run the 'demo' below it should be noted that there is an error in the 5.3 FINAL distribution which prevents the console from running whilst drools-guvnor is running. In order to see the demo cleanly - stop drools-guvnor. * 

*In the above configuration - reporting will work - however - see here for implications of moving away from H2 backend, and  http://ironclaws.wordpress.com/2012/06/23/jbpm-reporting-birt-tomcat-7-pure-jndi-without-tomcat-correction-2/ here if you want to configure the report engines initial JNDI context.* 

*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 Tomcat  

*g)* Stop drools-guvnor and restart gwt-console-server (to be on the safe side)       

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

Comment by going to Community
[https://community.jboss.org/docs/DOC-18626]

Create a new document in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120626/519f3ed3/attachment-0001.html 


More information about the jboss-user mailing list