JBPM与MYSQL的配置

1、下载jbpm-jpdl-suite-3.2.2与jbpm-starters-kit-3.1.4

2、下载mysql、eclipse

3、将jbpm-jpdl-suite-3.2.2的designer/eclipse路径下的features与plugins文件夹下的文件分别copy到eclipse相应的目录下,这样就安装完了jbpm的eclipse插件(如果安装成功,则Eclipse首选项里多了一个JBoss jBPM).

3、将jbpm-starters-kit-3.1.4中的jbpm文件夹copy到你的工作区间,导入作为一个项目.这个就是我们以后的基础项目.

4、通过工具或其它方式在mysql中建立一个库jbpm

5、在你刚刚导入的项目(jbpm)的lib文件夹下建立一个mysql文件夹,下载一个mysql的数据库驱动copy到你刚刚导入项目的lib文件夹的mysql目录下.

6、在你刚刚导入的项目(jbpm)的src/resources目录下建立mysql目录,并将/src/resources/hsqldb目录下的所有文件(create.db.hibernate.properties和identity.db.xml)拷贝入mysql中.

7、修改create.db.hibernate.properties如下

原:

hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver hibernate.connection.url=jdbc:hsqldb:hsql://localhost:1701 hibernate.connection.username=sa

hibernate.connection.password=

hibernate.show_sql=true

修改后:

hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.url=jdbc:mysql://127.0.0.1:3306/jbpm hibernate.connection.username=root //你的数据库用户名

hibernate.connection.password=root //登陆密码

hibernate.show_sql=true

8、修改build.deploy.xml

在<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">前添加如下内容:

<target name="create.db.mysql" depends="declare.jbpm.tasks" description="creates a mysql database with the jbpm tables and loads the processes in there.Run this target after starting mysql"> <jbpmschema actions="create" cfg="${basedir}/src/config.files/hibernate.cfg.xml" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties" /> <loadidentities file="${basedir}/src/resources/mysql/identity.db.xml" cfg="${basedir}/src/config.files/hibernate.cfg.xml" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties" /> <ant antfile="build.xml" target="build.processes" inheritall="false" /> <deployprocess cfg="${basedir}/src/config.files/hibernate.cfg.xml" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"> <fileset dir="build" includes="*.process" /> </deployprocess> </target> <property file="${basedir}/src/resources/mysql/create.db.hibernate.properties" /> <target name="execute.mysql.sql" description="execute a mysql sql script with -Dmysql.script=path-to-script."> <sql driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" delimiter=";" autocommit="true" οnerrοr="continue"> <classpath refid="classpath.ant" /> <transaction src="${mysql.script}" /> </sql> </target>

9、在eclipse中,右键点击工程下的build.deploy.xml文件,在菜单中选择“Run As/Ant Build…”,在出现的窗口中选择“target”为“create db mysql”,然后点击“Run”按钮,开始运行Ant.

 

等运行完毕后,可以在MySQl中查看到相应得数据库表结构已经建立,并且已经部署了websale需要用到的流程信息.

 

10、建立web运行需要内容;修改hibernate.cfg.xml

在eclipse中打开工程jbpm.3下的src/config.files目录下的hibernate.cfg.xml文件,修改其中的内容为

<!-- jdbc connection properties --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/jbpm</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">root</property> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <!-- other hibernate properties <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hibernate.use_sql_comments">false</property> -->

11、修改build.deploy.xml

修改原<target name="build.webapp" description="builds jbpm.war">......部分为

<target name="build.webapp" description="builds jbpm.war"> <ant antfile="build.xml" target="build.webapp" /> <mkdir dir="build/jbpm.war.dir" /> <copy todir="build/jbpm.war.dir"> <fileset dir="src/resources/jbpm.war" /> </copy> <copy todir="build/jbpm.war.dir/WEB-INF/classes"> <fileset dir="src/config.files" /> </copy> <copy todir="build/jbpm.war.dir/WEB-INF/lib"> <fileset dir="build" includes="jbpm*.jar,converter.jar" excludes="*src*.jar" /> <fileset dir="lib/jsf" includes="*.jar" /> <fileset dir="lib/dom4j" includes="*.jar" /> <fileset dir="lib/hibernate" includes="*.jar" /> <fileset dir="lib/mysql" includes="*.jar" /> <fileset dir="lib/commons" includes="commons-digester-*.jar, commons-beanutils-*.jar, commons-fileupload-*.jar" /> <fileset dir="lib/jboss" includes="*.jar" excludes="jboss*.jar, *servlet*.jar, *hsql*.jar" /> </copy> <jar destfile="build/jbpm.war"> <fileset dir="build/jbpm.war.dir" /> </jar> </target>

12、打包成war文件

在eclipse中,右键点击工程下的build.deploy.xml文件,在菜单中选择“Run As/Ant Build…”,在出现的窗口中选择“target”为“build webapp”,然后点击“Run”按钮,开始运行Ant.

13、在工程下build目录中,将jbpm.war文件拷贝到TOMCAT_HOME/webapps目录下.启动Tomcat.启动完成后,日志会不断输出,其中最后一句是"DEBUG [StaticNotifier] going to wait for (CMD_EXECUTOR, java.lang.Object@1df59bd) ",这表示 jBPM 在开始工作了,它不断进行轮询.

在浏览器中输入地址http://localhost:8080/jbpm,出现登录页面,配置成功.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值