jBPM5与Tomcat 6整合

以下介绍jBPM5与Tomcat6, h2 database and Bitronix transaction manager的整合。

1)从http://sourceforge.net/projects/jbpm/files/jBPM 5/jbpm-5.0-Final/下载 bpm-5.0.0-gwt-console.zip

解压得到jbpm-gwt-console-server-5.0.0.war,jbpm-gwt-console-5.0.0.war,重新命名 jbpm-console.war and gwt-console-server.war,copy到tomcat6的webapps目录下。

2)

创建 users 和 roles in TOMCAT_HOME/conf/tomcat-users.xml.

例子如下:

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

<tomcat-users>

<role rolename="tomcat"/>

<role rolename="role1"/>

<role rolename="manager"/>

<role rolename="admin"/>

<role rolename="user"/>

<user username="tomcat" password="tomcat" roles="tomcat"/>

<user username="both" password="tomcat" roles="tomcat,role1"/>

<user username="role1" password="tomcat" roles="role1"/>

<user username="manager" password="manager" roles="manager"/>

<user username="krisv" password="krisv" roles="manager,admin,user"/>

<user username="john" password="john" roles="manager,admin,user"/>

<user username="mary" password="mary" roles="manager,admin,user"/>

</tomcat-users>

3)设置 jbpm.console.directory in Catalina.bat (.sh)

例如:

-Djbpm.console.directory=C:/jbpm5/CR1/jbpm-installer/sample/evaluation/src/main/resources

4)复制JBPM_INSTALLER\jboss-4.2.3.GA server\default\data\birt into TOMCAT_HOME\birt. 提供report功能

5) Copy 数据库驱动 (e.g., h2.jar) and 所有相关的 jar files into TOMCAT_HOME/lib.

如果你使用其他数据库,例如:Oracle, Mysql , 你需要复制相关 jar files (http://community.jboss.org/thread/161643)

依赖的lib文件:

jbpm-persistence-jpa-5.0-CR1.jar

h2-1.2.124.jar

persistence-api-1.0.jar

geronimo-jta_1.0.1B_spec-1.0.1.jar

geronimo-jms_1.0.1B_spec-1.0.1.jar

javassist-3.4.GA.jar

hibernate-entitymanager-3.4.0.GA.jar

hibernate-core-3.3.0.SP1.jar

hibernate-commons-annotations-3.1.0.GA.jar

hibernate-annotations-3.4.0.GA.jar

ejb3-persistence-1.0.2.GA.jar

dom4j-1.6.1.jar

commons-collections-3.1.jar

antlr-2.7.6.jar

btm-tomcat55-lifecycle-1.3.3.jar

slf4j-api-1.5.2.jar

slf4j-jdk14-1.5.2.jar

btm-1.3.1.jar

6)启动数据库

例如, run ‘ant h2.start’ from JBPM_INSTALLER directory.

7)启动human task, 例如., run ‘ant start.human.task’ from JBPM_INSTALLER 目录

你也能整合Human task作为一个启动时加载的Servlet,参见 (http://community.jboss.org/thread/161260)

8)使用BTM(Bitronix transaction manager)初始化数据源JNDI(jdbc/testDS1)

(e.g., http://docs.codehaus.org/display/BTM/Tomcat13) 或者用TOMCAT JNDI (http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html) configuration documentation.

通过Bitronix transaction manager创建一个JNDI的数据源到TOMCAT中,具体步骤如下:
A.首先将以下的jar包复制到%TOMCAT_HOME%\lib的目录下:btm-2.0.1.jar ,jta-1.1.jar , slf4j-api-1.6.0.jar , slf4j-jdk14-1.6.0.jar , btm-tomcat55-lifecycle-2.1.0.jar
B.在 Catalina.bat文件中添加如下信息:
set CATALINA_OPTS=-Dbtm.root=%CATALINA_HOME% -Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties

C.修改%TOMCAT_HOME%\conf中server.xml,在
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
后添加
<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />
D.在%TOMCAT_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
E.修改%TOMCAT_HOME%\conf中content.xml文件在
<WatchedResource>WEB-INF/web.xml</WatchedResource>
后添加
<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />
<Resource name="jdbc/testDS1" auth="Container" type="javax.sql.DataSource"
maxActive="15" maxIdle="2" maxWait="10000" logAbandoned="true"
username="root" password="123456"
driverClassName="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" url="jdbc:mysql://localhost:3306/jbpm5db" />
F.在%TOMCAT_HOME%\conf目录下,创建resource.
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.jdbcx.JdbcDataSource
G.修改%TOMCAT_HOME%\webapps\gwt-console-server\WEB-INF\classes\META-INF\persistence.xml如下:
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />

==========================================

a.) Create the following 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

b.) Add transaction and Resource information after 'WatchedResource' line in TOMCAT_HOME/conf/context.xml as shown below.

.........

..........

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />

<Resource name="jdbc/testDS1" auth="Container" type="javax.sql.DataSource"

maxActive="15" maxIdle="2" maxWait="10000" logAbandoned="true" username="sa" password=""

driverClassName="org.h2.jdbcx.JdbcDataSource"

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

..........

.........

c.) Create 'resource.properties' in TOMCAT_HOME/conf as shown below.

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.jdbcx.JdbcDataSource

d.) Modify TOMCAT_HOME/conf/server.xml to include BTMLifecycleListener after the line that hasGlobalResourcesLifecycleListener as shown below.

.........

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />

....

e.) Modify TOMCAT_HOME\webapps\gwt-console-server\WEB-INF\classes\META-INF\persistence.xml to include the Bitronix value for hibernate.transaction.manager_lookup_class as shown below.

....

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

...

Login to console http://localhost:8080/jbpm-console (krisv/krisv)

 

 

原文:http://community.jboss.org/thread/161643

 

jBPM5 console + Oracle + Tomcat6

Here are the steps:

 

1.) Configure the jBPM console with Tomcat (http://community.jboss.org/thread/160572?tstart=0) and configure the datasource against the Oracle database.

 

2.) Copy Oracle driver (e.g. oracle-11.1.0.6.jar) into into TOMCAT_HOME/lib

 

3.) Modify hibernate.cfg.xml in TOMCAT_HOME\webapps\gwt-console-server\WEB-INF\classes\META-INF to include Oracle connection details.

 

e.g

......

......

<!-- Database connection settings -->

<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>

<property name="connection.url">jdbc:oracle:thin:@yourhostname:1521:test</property>

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

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

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

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

<!-- SQL dialect -->

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

.......

.......

 

Following two steps requires repackaging the jar files as the default embedded configuration files use h2. Also, do not use CR1 jar files as a lot of fixes for Oracle were done after CR1 release. Use latest SNAPSHOT jar files.

 

4.) Download and copy jbpm-human-task-5.0-SNAPSHOT.jar to TOMCAT_HOME/webapps/gwt-console-server/WEB-INF/lib

 

 

 

5.) Download and copy jbpm-bam-5.0-SNAPSHOT.jar to TOMCAT_HOME/webapps/gwt-console-server/WEB-INF/lib

 

 

6.) The BAM reports files (process_summary.rptdesign,overall_activity.rptdesign) need to be modified (using Eclispe BIRT plugin) to inlcude Oracle connection details.

 

7.) Also the Oracle driver needs to be included from BIRT ReportEngine.

Its location is TOMCAT_HOMEbirt\ReportEngine\plugins\org.eclipse.birt.report.data.oda.jdbc_2.3.2.r232_v20090212\drivers

 

Step6 is mainly required as the h2 database connection details are included and these should be replace with your Oracle database information.

 

Also,it should be noted that the design files do not have the latest table information. One of the columns for the table NodeInstanceLog (DATE has been replaced with LOG_DATE) has been changed (http://community.jboss.org/message/571322).

 

Attached please find the example reports. You need to provide the hostname and connection details.

 

You can not open these design files with the latest BIRT plugin as these reports use 2.3.1.

Download the BIRT designer from

http://archive.eclipse.org/birt/downloads/build.php?build=R-R1-2_3_1-200809221151

http://archive.eclipse.org/birt/downloads/build.php?build=R-R1-2_3_1-200809221151

and modify the report files process_summary.rptdesign,overall_activity.rptdesign in TOMCAT_HOME/BIRT directory.

 

 

 

 

 

原文:http://community.jboss.org/thread/160572?tstart=0

 

jBPM5 Console Integration with Tomcat6

 

Here are the required steps to get the jBPM5 console running in Tomcat6

 

 

1.) Copy the console war files provided in JBPM_INSTALLER/lib into Tomcat’s webapps directory

These war files can also be downloaded from (http://sourceforge.net/projects/jbpm/files/jBPM%205/jbpm-5.0-CR1/jbpm-5.0-CR1-gwt-console.zip/download). This download has two war files jbpm-gwt-console-5.0-CR1.war and jbpm-gwt-console-server-5.0-CR1.war. Rename them to jbpm-console.war and gwt-console-server.war and copy them to TOMCAT_HOME/webapps

 

2.) Create users and roles in TOMCAT_HOME/conf/tomcat-users.xml.

Here is an example

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

<tomcat-users>

<role rolename="tomcat"/>

<role rolename="role1"/>

<role rolename="manager"/>

<role rolename="admin"/>

<role rolename="user"/>

<user username="tomcat" password="tomcat" roles="tomcat"/>

<user username="both" password="tomcat" roles="tomcat,role1"/>

<user username="role1" password="tomcat" roles="role1"/>

<user username="manager" password="manager" roles="manager"/>

<user username="krisv" password="krisv" roles="manager,admin,user"/>

<user username="john" password="john" roles="manager,admin,user"/>

<user username="mary" password="mary" roles="manager,admin,user"/>

</tomcat-users>

 

 

3.) Set the jbpm.console.directory in Catalina.bat (.sh)

Here is an example.

.. -Djbpm.console.directory=C:/jbpm5/CR1/jbpm-installer/sample/evaluation/src/main/resources ..

 

4.) Copy JBPM_INSTALLER\jboss-4.2.3.GA server\default\data\birt into TOMCAT_HOME\birt. This will provide the reporting functionality

 

5.) Copy the database driver (e.g., h2.jar) and all the dependant jar files into TOMCAT_HOME/lib.

 

Here are the required libraries:

 

jbpm-persistence-jpa-5.0-CR1.jar

h2-1.2.124.jar

persistence-api-1.0.jar

geronimo-jta_1.0.1B_spec-1.0.1.jar

javassist-3.4.GA.jar

hibernate-entitymanager-3.4.0.GA.jar

hibernate-core-3.3.0.SP1.jar

hibernate-commons-annotations-3.1.0.GA.jar

hibernate-annotations-3.4.0.GA.jar

ejb3-persistence-1.0.2.GA.jar

dom4j-1.6.1.jar

commons-collections-3.1.jar

antlr-2.7.6.jar

 

 

6.) Start database:

e.g, run ‘ant h2.start’ from JBPM_INSTALLER directory

 

7.) Start human task, e.g., run ‘ant start.human.task’ from JBPM_INSTALLER directory

 

 

This assumes that a datasource JNDI (jdbc/testDS1) is configured in Tomcat and a transaction manager (such as Bitronix or JOTM or Atomikos etc) is configured on Tomcat.

Refer to http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html for JNDI configuration on Tomcat6.

 

Login to console http://localhost:8080/jbpm-console (krisv/krisv)

posted @ 2011-11-10 08:43  skyme  阅读(5320)  评论(0)    收藏  举报