JBPM5配置进入到TOMCAT和迁移数据源

将jbpm5安装目录下的/lib目录下的jbpm-5.1.0.Final-gwt-console.zip文件夹解压,得到两个文件jbpm-gwt-console-xxx.war和jbpm-gwt-console-server-xxx.war。将这两个文件重命名为jbpm-console.war和gwt-console-server.war然后拷贝到tomcat目录下的webapps中。

修改%TOMCAT_HOME%\conf目录中的tomcat-users.xml文件,修改属性如下:

<?xmlversion='1.0'encoding='utf-8'?>

<rolerolename="tomcat"/>

<rolerolename="role1"/>

<rolerolename="manager"/>

<rolerolename="admin"/>

<rolerolename="user"/>

<userusername="tomcat"password="tomcat"roles="tomcat"/>

<userusername="both"password="tomcat"roles="tomcat,role1"/>

<userusername="role1"password="tomcat"roles="role1"/>

<userusername="manager"password="manager"roles="manager"/>

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

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

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

</tomcat-users>

将jbpm控制目录写入到Catalina.bat文件中,例如:

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

将下载下来的JBPM目录的中的JBOSS目录中的server\default\data\birt复制到%TOMCAT_HOME%\中

将数据库驱动jar和以下jar包复制到%TOMCAT_HOME%\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,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,geronimo-jta_1.0.1B_spec-1.0.1.jar如果有更高的版本可以使用高版本的jar。

通过Bitronixtransactionmanager创建一个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文件中添加如下信息:

setCATALINA_OPTS=-Dbtm.root=%CATALINA_HOME%-Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties

C.修改%TOMCAT_HOME%\conf中server.xml,在

<Listenerclassname="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

后添加

<Listenerclassname="bitronix.tm.integration.tomcat55.BTMLifecycleListener"/>

D.在%TOMCAT_HOME%\conf目录下,创建btm-config.propertie添加:

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>

后添加

<Transactionfactory="bitronix.tm.BitronixUserTransactionObjectFactory"/>

<Resourcename="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.Propertie文件添加:

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如下:

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

至此,配置全部完成。

相关推荐