在Tomcat中配置运行jbpm-3.0自带的websale

觉得写得不错因此转载了过来,学习了.

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 导入

配置连接 MySQL

1. 在 'jbpm-3.0/lib' 目录下 创建 'mysql' 目录

2. 将 mysql数据库驱动 (mysql-connector-java-3.1.7-bin.jar) 拷贝到 'mysql' 目录

3. 在 mysql 中创建一个数据库,数据库名字

4. 在 'jbpm-3.0/src/resources'目录下创建 '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/

hibernate.connection.username= hibernate.connection.password=

hibernate.show_sql=true hibernate.query.substitutions=true 1, false 0

hibernate.c3p0.min_size=1 hibernate.c3p0.max_size=3

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" />
<fileset dir="lib/bsh" includes="*.jar" />

2.因为 Hibernate 不能将它的SessionFactory与tomcat的jndi 绑定 , 我们直接在源码中修改

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.username", "");

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'

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值