配置jbpm backend 为 mysql

配置jbpm backend 为 mysql

1 安装 mysql

详细步骤略,配置能启动

    yum install mariadb-server

2 下载sql文件 并执行

从红帽下载

BPMS-6.4.0/jboss-bpmsuite-6.4.0.GA-supplementary-tools.zip

在这里能找到各种数据库的ddl sql文件。

找到

 jboss-brms-bpmsuite-6.4-supplementary-tools/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql

source 到mysql创建结构,步骤略。。。

3 建库修改字符集

CREATE DATABASE IF NOT EXISTS jbpm DEFAULT CHARSET utf8 COLLATE utf8_general_ci

/etc/my.cnf

collation_server=utf8_unicode_ci
character_set_server=utf8

4 创建jbpm用户

   CREATE USER 'jbpm'@'localhost' IDENDIFIED BY 'jbpm'; 
GRANT ALL ON jbpm TO 'jbpm'@'localhost';

5 配置mysql jdbc connect 为 jboss module

 wget mysql-connector-java-5.1.15.tar.gz
tar -xvf mysql-connector-java-5.1.15.tar.gz
mkdir -p $EAP_HOME/modules/com/mysql/main
cp mysql-connector-java-5.1.15.jar $EAP_HOME/modules/com/mysql/main

echo '<?xml version="1.0" encoding="UTF-8"?><module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.15.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies></module>' > $EAP_HOME/modules/com/mysql/main/module.xml

通过jmx cli 直接配置mysql driver

$EAP_HOME/bin/jboss-cli.sh
connect
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)

6 配置jboss

编辑

$EAP_HOME/standalone/configuration/standalone.xml

# 直接修改原来h2 的数据源配置为下面:
<datasources>
<datasource jta="true" jndi-name="java:jboss/datasources/ExampleDS" pool-name="MySQLDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
<driver>mysql</driver>
<security>
<user-name>jbpm</user-name>
<password>jbpm</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>

7 设置kie的 hibernate

EAP_HOME/standalone/deployments/business-central.war/WEB-INF/classes/META-INF/persistence.xml

# 直接注释掉原来h2的dialect 改为下面
<!-- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /> -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

完了

写的有点粗糙。