在Tomcat中配置运行jbpm自带的websale
文字来自jbpm官方论坛
1. 从 http://www.jboss.com/products/jbpm/downloads 下载 jbpm-3.0.zip
2. 解压缩 jbpm-3.0.zip 到 'temp' 目录
3. 使用 eclipse, 将 'temp\jbpm-3.0' 作为 an existing project into workspace 导入 [www.iocblog.net 来源]
配置连接 MySQL
1. 在 'jbpm-3.0\lib' 目录下 创建 'mysql' 目录
2. 将 mysql数据库驱动 (mysql-connector-java-3.1.7-bin.jar) 拷贝到 'mysql' 目录
3. 在 mysql 中创建一个数据库,数据库名字
5. 把两个配置文件 (create.db.hibernate.properties, identity.db.xml) 从 'hsqldb' 目录下 拷贝到 'mysql' 目录
6. 按下面所示编辑 'create.db.hibernate.properties' 文件: hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.url=jdbc:mysql://localhost:3306/
7. 另一个文件 'identity.db.xml'不做改动
8. 在 'jbpm-3.0' 根目录, 编辑ANT的脚本 'build.deploy.xml' 找到 target name="create.db", 删除 db.start, db.stop 在这个目标块中将所有的'hsqldb' 替换为 'mysql'
9. 运行ANT ant create.db -buildfile build.deploy.xml 运行完毕后就会发现mysql中多出很多表,这是jbpm保持状态用的
创建 jbpm.war 使其在tomcat中运行
默认的打war包时,掉了一些库文件
1. 在 eclipse中, 编辑ant脚本 'build.deploy.xml' 在目标块 target name="build.webapp" 中在
<copy todir="build/jbpm.war.dir/WEB-INF/lib">
<fileset dir="build" includes="jbpm-webapp-${jbpm.version}.jar" />
<fileset dir="build" includes="jbpm*.jar" />
<fileset dir="lib/hibernate" includes="*.jar" /> [www.iocblog.net 来源]
<fileset dir="lib/bsh" includes="*.jar" />
3. 打开源文件 JbpmSessionFactory.java, 在 getInstance() 方法里, 删除下面代码
InitialContext initialContext = new InitialContext(); Object o = initialContext.lookup(jndiName);
将下面这行
instance = (JbpmSessionFactory) PortableRemoteObject.narrow(o, JbpmSessionFactory.class);
替换为 instance = (JbpmSessionFactory) PortableRemoteObject.narrow(new JbpmSessionFactory(createConfiguration()), JbpmSessionFactory.class);
4.在 createConfiguration(String configResource) 方法里, 注释掉这段代码
String hibernatePropertiesResource = JbpmConfiguration.getString("jbpm.hibernate.properties");
if (hibernatePropertiesResource!=null) { Properties hibernateProperties = new Properties();
try { hibernateProperties.load( ClassLoaderUtil.getStream(hibernatePropertiesResource) ); }
catch (IOException e) { e.printStackTrace(); throw new RuntimeException("couldn't load the hibernate properties from resource '"hibernatePropertiesResource"'", e); } log.debug("overriding hibernate properties with "+ hibernateProperties); configuration.setProperties(hibernateProperties); } 同时加入下面的代码
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); configuration.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver"); configuration.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/
configuration.setProperty("hibernate.connection.password", "
configuration.setProperty("hibernate.connection.pool_size", "15");
5. 运行脚本命令 ant build ant build.webapp -buildfile build.deploy.xml
6. 将jbpm.war 从 'jbpm-3.0\build' 下拷贝到 'tomcat.home\webapps'
7. 启动 tomcat
8. 打开浏览器 'http://localhost:8080/jbpm'
文章整理:iocblog
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。