• 1.工作台用户Authentication配置

JBPM web工作台预安装了用户认证与授权模块,位于jbpm-console-7.1.0.Final-wildfly-10.1.0.Final.war文件内:WEB-INF/jboss-web.xml

用户名、密码、角色默认用property文件进行配置;

配置位置:

 <security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization map-groups-to-roles="false">
<properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
<keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
</ssl>
</server-identities>
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>

默认用户自己看看就可以!

Home → Admin查看,

添加用户需要用脚本进行添加:

/bin/sh $JBOSS_HOME/bin/add-user.sh
--user-properties $JBOSS_HOME/standalone/configuration/users.properties
--group-properties $JBOSS_HOME/standalone/configuration/roles.properties
--realm ApplicationRealm

2.更换数据库配置

JBPM默认使用了H2 database,实际环境中使用Mysql,修改配置:

先准备好Mysql数据库,创建一个jbpm数据库,密码为jbpm;jbpm-installer-full-7.1.0.Final为解压后的文件夹

  • jbpm-installer-full-7.1.0.Final/build.properties
# data base related properties
db.driver.jar=${install.home}/db/driver/${db.driver.jar.name}
db.driver.module.dir=${jboss.home}/modules/${db.driver.module.prefix}/main/
# default is H2
#H2.version=1.3.168
#db.name=h2
#db.driver.jar.name=h2-${H2.version}.jar
#db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar
#other options are:
#mysql
db.name=mysql
db.driver.module.prefix=com/mysql
db.driver.jar.name=mysql-connector-java-5.1.18.jar
db.driver.download.url=https://repository.jboss.org/nexus/service/local/repositories/central/content/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar
  • jbpm-installer-full-7.1.0.Final/db/jbpm-persistence-JPA2.xml

<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>

修改为:

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
  • jbpm-installer-full-7.1.0.Final/db/mysql_module.xml
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java.jar"/>
</resources> <dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>

修改为:

<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.18.jar"/>
</resources> <dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
  • Application server configuration

    • standalone-*.xml 包含:standalone-full-wildfly-10.1.0.Final.xml、standalone-wildfly-10.1.0.Final.xml

    原配置:

                   <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:tcp://localhost/~/jbpm-db;MVCC=TRUE</connection-url>
    <driver>h2</driver>
    <security>
    <user-name>sa</user-name>
    </security>
    </datasource>
    <drivers>
    <driver name="h2" module="com.h2database.h2">
    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
    </driver>
    </drivers>

修改后:

<datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" 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>
  • 修改build.xml,去掉h2数据库服务启动与关闭
  <!-- 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" /> <target name="stop.demo.eclipse" depends="stop.h2" />

修改后

  <!-- Start Demo -->
<target name="start.demo" depends="start.jboss,start.eclipse" /> <!-- Start Demo (Eclipse) -->
<target name="start.demo.eclipse" depends="start.eclipse" /> <!-- Start Demo (No Eclipse)-->
<target name="start.demo.noeclipse" depends="start.jboss" /> <!-- Stop Demo -->
<target name="stop.demo" depends="stop.jboss" /> <target name="stop.demo.eclipse" depends="" />

配置修改后,执行以下命令:

ant stop.demo

ant clean.demo

ant install.demo

ant start.demo
05-11 18:21