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'
http://www.tkk7.com/ronghao 榮浩原創,轉載請注明出處:)
posted on 2005-11-10 17:31
ronghao 閱讀(3415)
評論(5) 編輯 收藏 所屬分類:
工作日志