使用JBPM5.4官网的完全安装包 连接mysql数据库。
一、安装JBPM5.4
到jboss官网下载JBPM5.4官网的完全安装包 jbpm-5.4.0.Final-installer-full.zip并解压。安装前请先安装ant工具 http://ant.apache.org/bindownload.cgi
找到JBPM5.4安装包的根目录,通过cmd命令找到 E:\ZiLiao\api-jar\jbpm\jbpm-5.4.0.Final-installer-full\jbpm-installer。
输入ant安装命令 ant install.demo 进行安装,此过程必须联网,安装过程会
l 下载JBoss AS
l 下载Eclipse
l 安装Drools Guvnor into JBoss AS
l 安装Oryx Designer into JBoss AS
l 安装the jBPM gwt-console intoJBoss AS
l 安装the jBPM Eclipse plugin
l 安装the Drools Eclipse plugin
如果计算机中已有Jboss服务器并设置JBOSS_HOME环境变量请删除,否则会影响Jboss安装。
提示安装成功后,可以进行测试安装结果:
分别输入 ant start.h2 (启动h2数据库);ant start.jboss;
如果安装成功 则在浏览器中输入http://localhost:8080/jbpm-console/app.html 可以进入JBPM控制台;
二、连接mysql
转自:http://blog.csdn.net/haiyan2012/article/details/8881021
关闭jboss服务器 输入ant stop.jboss
然后在安装包中进行文件替换
需要修改的文件为:
- build.properties
- build.xml
- db/jbpm-persistence-JPA2.xml
- db/task-persistence-JPA2.xml
- standalone.xml
- task-service/resources/META-INF/persistence.xml
- lib/jbpm-gwt-console-server-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml
- lib/jbpm-human-task-war-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml
-
-
- 1.下载MySql驱动放在安装目录/db/drivers/下。这里将名字修改为mysql-connector-java.jar。
-
在MySql数据库中创建task和jbpm数据库。
- mysql> CREATE DATEBASE IF NOT EXISTS jbpm5;
- mysql> CREATE USER 'jbmp5'@'localhost' IDENTIFIED BY 'jbpm5';
- mysql> GRANT ALL PRIVILEGES ON jbpm5.* TO 'jbpm5'@'localhost';
- mysql> CREATE DATEBASE IF NOT EXISTS task;
- mysql> CREATE USER 'task'@'localhost' IDENTIFIED BY 'task';
- mysql> GRANT ALL PRIVILEGES ON task.* TO <a href="mailto:'task'@'localhost;">'task'@'localhost;
- </a>
2.修改db/jbpm-persistence-JPA2.xml和task-persistence-JPA2.xml,修改方式类似
- 将
- <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
- 或
- <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
- 修改为
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
附:
Hibernate SQL Dialects (
hibernate.dialect
)RDBMS DialectDB2 org.hibernate.dialect.DB2Dialect
DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
PostgreSQL org.hibernate.dialect.PostgreSQLDialect
MySQL org.hibernate.dialect.MySQLDialect
org.hibernate.dialect.MySQL5Dialect
MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i org.hibernate.dialect.Oracle9iDialect
Oracle 10g org.hibernate.dialect.Oracle10gDialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server org.hibernate.dialect.SQLServerDialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect
- 将
- <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/runtime/task" />
- <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="create" />
- <property name="hibernate.show_sql" value="false" />
- </properties>
- 修改为
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
- <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
- <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/task" />
- <property name="hibernate.connection.username" value="task"/>
- <property name="hibernate.connection.password" value="task"/>
- <property name="hibernate.connection.autocommit" value="false" />
- <property name="hibernate.max_fetch_depth" value="3"/>
- <property name="hibernate.hbm2ddl.auto" value="create" />
- <property name="hibernate.show_sql" value="false" />
- </properties>
4.修改db/mysql_module.xml中jar的名称为mysql.jar,与db/drivers中的jar名称对应。
- <resources>
- <resource-root path="mysql-connector-java.jar"/>
- </resources>
5.使用的是Jboss7,修改安装目录下的standalone.xml- 将
- <subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
- <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
- <driver>h2</driver>
- <security>
- <user-name>sa</user-name>
- <password>sa</password>
- </security>
- </datasource>
- <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true">
- <connection-url>jdbc:h2:~/jbpm</connection-url>
- <driver>h2</driver>
- <pool>
- <min-pool-size>1</min-pool-size>
- <max-pool-size>4</max-pool-size>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>sa</user-name>
- </security>
- <validation>
- <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
- <validate-on-match>false</validate-on-match>
- <background-validation>false</background-validation>
- </validation>
- </datasource>
- <drivers>
- <driver name="h2" module="com.h2database.h2">
- <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
- </subsystem>
- 修改为
- <subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
- <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
- <driver>h2</driver>
- <security>
- <user-name>sa</user-name>
- <password>sa</password>
- </security>
- </datasource>
- <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true">
- <connection-url>jdbc:mysql://localhost:3306/jbpm5</connection-url>
- <driver>mysql</driver>
- <pool>
- <min-pool-size>1</min-pool-size>
- <max-pool-size>4</max-pool-size>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>jbpm5</user-name>
- <password>jbpm5</password>
- </security>
- <validation>
- <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
- <validate-on-match>false</validate-on-match>
- <background-validation>false</background-validation>
- </validation>
- </datasource>
- <drivers>
- <driver name="mysql" module="com.mysql">
- <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
- </subsystem>
6.修改安装目录下的build.properties,将数据库的配置从H2,改为MySql7.修改/lib/jbpm-human-task-war-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml文件中的 hibernate.dialect- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
8.修改/lib/jbpm-gwt-console-server-5.4.0.Final-EE6.war/ WEB-INF/classes/META-INF/persistence.xml 文件中的 hibernate.dialect和 hibernate.hbm2ddl.auto。- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
- <property name="hibernate.hbm2ddl.auto" value="create" />
9.修改build.xml- 在
- <java classname="org.jbpm.DemoTaskService" fork="true">
- <classpath>
- <pathelement path="${install.home}/task-service/target"/>
- <path refid="classpath.human.task" />
- </classpath>
- </java>
- 中加
- <sysproperty key="jbpm.user.group.mapping" value="file:///F:/PDF/jbpm/jbpm-installer/jboss-as-7.1.1.Final/standalone/configuration/roles.properties"/>
- 变为
- <java classname="org.jbpm.DemoTaskService" fork="true">
- <sysproperty key="jbpm.user.group.mapping" value="file:///F:/PDF/jbpm/jbpm-installer/jboss-as-7.1.1.Final/standalone/configuration/roles.properties"/>
- <classpath>
- <pathelement path="${install.home}/task-service/target"/>
- <path refid="classpath.human.task" />
- </classpath>
- </java>
- 根据你的实际目录修改
在- <!-- Start Demo -->
- <target name="start.demo" depends="start.h2,start.jboss,start.eclipse" />
- <!-- Start Demo (Eclipse) -->
- <target name="start.demo.eclipse" depends="start.h2,start.eclipse" />
- <!-- Start Demo (No Eclipse)-->
- <target name="start.demo.noeclipse" depends="start.h2,start.jboss" />
- <!-- Stop Demo -->
- <target name="stop.demo" depends="stop.h2,stop.jboss" />
中加- <!-- Start Demo -->
- <target name="start.demo" depends="start.h2,start.jboss,start.eclipse" />
- <!-- Start Demo (DB) -->
- <target name="start.demo.db" depends="start.jboss, start.eclipse" />
- <!-- Start Demo (DB, No Eclipse) -->
- <target name="start.demo.db.noeclipse" depends="start.jboss" />
- <!-- Start Demo (Eclipse) -->
- <target name="start.demo.eclipse" depends="start.h2,start.eclipse" />
- <!-- Start Demo (No Eclipse)-->
- <target name="start.demo.noeclipse" depends="start.h2,start.jboss" />
- <!-- Stop Demo -->
- <target name="stop.demo" depends="stop.h2,stop.jboss" />
- <!-- Stop Demo (DB)-->
- <target name="stop.demo.db" depends="stop.jboss" />
10.在CMD中到你的安装目录下,运行- ant install.demo
- 或
- ant install.demo.noeclipse
11.运行- ant start.human.task
12.运行- ant start.jboss
启动成功后再运行- ant stop.jboss
- <propertyname="hibernate.hbm2ddl.auto"value="update"/>
-