Run JBPM3.0.x with MySQL

**************************************************
*** How to run JBPM with MySQL                   ***
**************************************************

##################################################
### Create Database&User for JBPM
##################################################
mysql>create database jbpmtest;
mysql>grant all on *.* to jbpmtest@localhost identified by 'jbpmtest' with grant option;

##################################################
### Set JBPM3.0.x Environment(推荐使用1.5的JDK)
##################################################
----------------------------------------------------------------------------------------------------
set JAVA_HOME=C:/jdk1.5.0_05
set CLASSPATH=C:/jdk1.5.0_05/lib/dt.jar;C:/jdk1.5.0_05/lib/tools.jar;.
----------------------------------------------------------------------------------------------------
############################################################
### Set JBPM3.0.x Build Environment(With JDK1.5.*)
############################################################

######安装必备环境:j2sdk、ant、jboss
###一.安装j2sdk(1.5)
1.按照指示直到完成
2.设置环境变量JAVA_HOME 
3.设置环境变量CLASSPATH
eg: set CLASSPATH=.;C:/jdk1.5.0_05/lib/tools.jar;C:/jdk1.5.0_05/lib/dt.jar

###二.安装ant(1.6.5)
1.把ant  的安装包解压到c:/ant(或其他目录)
2.设置环境变量ANT_HOME 
3.在CLASSPATH环境变量后面加入%ANT_HOME%/lib/ant.jar;
4.在PATH后面加入%ANT_HOME%/bin;

###三. 安裝jboss(4.0.2)[注意:运行JBPM3.X必须用jboss4.0.2版本或者以上的版本]
1.把jboss的安装包解压到c:/jboss(或其他目录)(版本4.x)
2.设置环境变量JBOSS_HOME?
3.在CLASSPATH环境变量后面加入 %JBOSS_HOME%/lib;
###四. 修改JBPM的编译参数
1.编辑%JBPM_HOME%/build.properties文件,修改如下参数:
 jbpm.version=3.0
 ant.home=c:/ant
 jbpm.home=c:/jbpm
 jboss.home=c:/jboss
 jboss.version=4.0.x(#不要去修改它)
 jboss.source.configuration=default
2.建立需要的相关目录并修改有关文件
  (1)Create 'mysql' directory under '%JBPM_HOME%/lib' 
  (2)copy mysql-connector-java-3.1.7-bin.jar(或更新的驱动程序,这些驱动程序可以从http://www.mysql.com下载) into '%JBPM_HOME%/lib'
  (3)Under '%JBPM_HOME%/src/resources', create 'mysql' directory
  (4)Copy two configuration files (create.db.hibernate.properties, identity.db.xml) from 'hsqldb' directory into 'mysql' directory
  (5)Edit the file 'create.db.hibernate.properties' with the following values:
    # innodb has acid compliance, might be best to use it?
   hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
   # could also be used maybe, see hibernate and mysql websites for more info
   # hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect
   # hibernate.dialect=org.hibernate.dialect.MySQLDialect
 
   hibernate.connection.driver_class=com.mysql.jdbc.Driver
   hibernate.connection.url=jdbc:mysql://localhost:3306/jbpmtest
   hibernate.connection.username=jbpmtest
   hibernate.connection.password=jbpmtest

   hibernate.show_sql=true
   hibernate.query.substitutions=true 1, false 0
   hibernate.c3p0.min_size=1
   hibernate.c3p0.max_size=3
 (6)Leave the file 'identity.db.xml' as it is
 (7)In '%JBPM_HOME%' directory, edit the build file 'build.deploy.xml'
   In target name="create.db", delete db.start, db.stop if your database server is running by default.
   Replace all instance of 'hsqldb' with 'mysql',for example,replace the follow segment:
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     <target name="create.db" depends="declare.jbpm.tasks, db.clean, db.start" description="creates a hypersonic database with the jbpm tables and loads the processes in there">
       <jbpmschema actions="create" properties="src/resources/hsqldb/create.db.hibernate.properties"/>
       <loadidentities file="src/resources/hsqldb/identity.db.xml" properties="src/resources/hsqldb/create.db.hibernate.properties"/>
       <ant antfile="build.xml" target="build.processes" inheritall="false" />
       <deploypar properties="src/resources/hsqldb/create.db.hibernate.properties">
        <fileset dir="build" includes="*.par" />
       </deploypar>
       <antcall target="db.stop" />
     </target>
    to:
      <target name="create.db" depends="declare.jbpm.tasks, db.clean, db.start" description="creates a mysql database with the jbpm tables and loads the processes in there">
       <jbpmschema actions="create" properties="src/resources/mysql/create.db.hibernate.properties"/>
       <loadidentities file="src/resources/mysql/identity.db.xml" properties="src/resources/mysql/create.db.hibernate.properties"/>
       <ant antfile="build.xml" target="build.processes" inheritall="false" />
       <deploypar properties="src/resources/mysql/create.db.hibernate.properties">
        <fileset dir="build" includes="*.par" />
       </deploypar>
       <antcall target="db.stop" />
     </target>
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    replace the follow segment:
      <target name="db.start" depends="declare.jbpm.tasks">
       <starthsqldb lib="${jboss.home}/server/default/lib/hsqldb.jar"
                 database="${hsqldb.database}"
                 port="${hsqldb.port}" />
     </target>
   to:
     <target name="db.start" depends="declare.jbpm.tasks">
     </target>
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    replace the follow segment:
      <target name="db.stop">
       <java classname="org.hsqldb.util.ShutdownServer" fork="true">
        <classpath refid="classpath.hsqldb"/>
        <arg line="-url jdbc:hsqldb:hsql://localhost:${hsqldb.port} -user sa"/>
       </java>
     </target>
    to:
      <target name="db.stop">
     </target> 
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  (8)To populate the database with data, go to directory 'jbpm-3.0' in command prompt and type
    ant create.db -buildfile build.deploy.xml

###五. 修改jboss的默认设置以适合运行MySQL版的JBPM
1.首先拷贝%JBPM_HOME%/lib/mysql/mysql-connector-java-3.1.7-bin.jar到%JBOSS_HOME%/server/default/lib/目录下
2.拷贝%JBOSS_HOME%/docs/examples/jca/mysql-ds.xml到%JBOSS_HOME%/server/default/deploy/目录下,并修改mysql-ds.xml
文件以适合我们的环境。如下:
<datasources>
  <local-tx-datasource>
    <jndi-name>DefaultDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/jbpmtest</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>jbpmtest</user-name>
    <password>jbpmtest</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
    <!-- sql to call when connection is created
    <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->
    <!-- sql to call on an existing pooled connection when it is obtained from pool
    <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

############################################################
### Build JBPM
############################################################
1.编译JBPM
C:/jbpm>ant

2.部署JBPM到指定的Jboss服务器
C:/jbpm>ant –f build.deploy.xml

3.检查C:/jboss/server目录下是否多了jbpm文件夹

############################################################
### Run JBPM
############################################################
1. 在%JBOSS_HOME%/bin目录下执行:run.bat –c jbpm [表示执行以jbpm为主的server环境,若只有打run.bat代表使用的是default ]
2.启动IE,在地址栏输入http://localhost:8080/jbpm/ ,出现提示登陆的画面就表示成功了

参考网址:

http://www.javaworld.com.tw/jute/post/print?bid=9&id=117585( 請問jbpm3.0有誰使用過了嗎?)

http://3pig.anyp.cn/blog/archive/152996/050912143602760.aspx (Tomcat5+jBpm3.0+mysql 配置)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值