锘??xml version="1.0" encoding="utf-8" standalone="yes"?> Following properties can be specified in the jbpm.properties configuration file Table 5.2.
鏄ㄥぉ鑳℃悶浜嗕竴澶╋紝铏界劧寮勫ソ浜唈BPM鐨勬暟鎹簱璁劇疆錛屼絾鏄粡榪囨槰鏅氬洖鍘繪煡鐪婬elp 鍏充簬deployment鐨勬枃妗e拰鐩稿叧鐨勬簮鐮侊紝緇堜簬寮勫嚭鏈綆鍗曠殑鏂規(guī)硶銆?BR>
Help Deployment涓叧浜巎bpm.properties
Property
Default Value
Description
jbpm.session.factory.jndi.name
if specified, the JbpmSessionFactory.getInstance() method will fetch the singleton instance from the given JNDI location. Otherwise a new JbpmSessionFactory will be created upon initialization of the singleton instance.
婧愮爜涓殑榪欎釜JbpmSessionFactory.java綾諱腑
public static JbpmSessionFactory getInstance() {
if (instance==null) {
// if there is a JNDI name configured
if (jndiName!=null) {
try {
// fetch the JbpmSessionFactory from JNDI
log.debug("fetching JbpmSessionFactory from '"+jndiName+"'");
InitialContext initialContext = new InitialContext();
Object o = initialContext.lookup(jndiName);
instance = (JbpmSessionFactory) PortableRemoteObject.narrow(o, JbpmSessionFactory.class);
} catch (Exception e) {
throw new RuntimeException("couldn't fetch JbpmSessionFactory from jndi '"+jndiName+"'");
}
} else { // else there is no JNDI name configured
// create a new default instance.
log.debug("building singleton JbpmSessionFactory");
instance = buildJbpmSessionFactory();
}
}
return instance;
}
鍙互鐪嬪埌鍙彲浠ヤ慨鏀筳bpm.properties鏂囦歡灝眔k浜嗐?BR>
鐜板湪琛屽姩錛佺紪杈慾bpm\deploy\jbpm.sar涓殑jbpm.sar.cfg.jar鏂囦歡
灝咼bpmSessionFactory淇敼濡備笅
jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl
jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance
#jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory
jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml
#jbpm.hibernate.properties=jbpm.hibernate.properties
鍥犳jbpm.hibernate.properties涔熷彲浠ュ垹闄や簡錛屼箣鍚庝慨鏀筳bpm.hibernate.cfg.xml鍜屽彟澶栦竴涓枃浠剁殑鏁版嵁搴撻厤緗紝鍙﹀寮勪釜鏁版嵁搴撶殑driver灝眔k鍟︼紒錛侊紒
榪欎袱澶╅兘蹇姄鐙備簡錛侊紒錛佹棤璁哄浣曢兘涓嶈兘浣跨敤鑷繁鍒涘緩鐨刴ysql鏁版嵁搴?IMG height=19 src="http://www.aygfsteel.com/Emoticons/cry_smile.gif" width=19 border=0>
灝卞揩鏀懼純鐨勬椂鍊欙紝鑰佸ぉ緇堜簬鐪烽【鎴戝暒錛侊紒錛?IMG height=19 src="http://www.aygfsteel.com/Emoticons/regular_smile.gif" width=19 border=0>
鏍規(guī)嵁涓浜涘墠浜虹殑blog鍜屽伐浣滄祦緹や笂鐨勪漢鐨勬寚鐐癸紝鐜版葷粨浠ヤ笅涓ょ閰嶇疆鐢╩ysql鏁版嵁搴揹atasource鐨勬柟娉曘?BR>
錛堜竴錛夐渶瑕佹敼jBPM婧愮爜錛堣繖涓柟娉曚笉澶ソ錛屼絾鏄彲浠ヨ璇繪簮鐮侊紝浜嗚В鏈哄埗錛?BR>
閰嶇疆榪炴帴 MySQL
1. 鍦?SPAN lang=EN-US>jbpm-3.0\lib鐩綍涓?鍒涘緩mysql鐩綍
2. 灝?SPAN lang=EN-US> mysql鏁版嵁搴撻┍鍔?SPAN lang=EN-US> (mysql-connector-java-3.1.7-bin.jar) copy鍒?SPAN lang=EN-US>mysql 鐩綍
3. 鍦?SPAN lang=EN-US> mysql 涓垱寤轟竴涓暟鎹簱錛屾暟鎹簱鍚嶅瓧
4. 鍦?SPAN lang=EN-US>jbpm-3.0\src\resources鐩綍涓嬪垱寤?SPAN lang=EN-US>mysql鐩綍
5. 鎶婁袱涓厤緗枃浠?SPAN lang=EN-US> (create.db.hibernate.properties, identity.db.xml) 浠?SPAN lang=EN-US>hsqldb鐩綍涓?鎷瘋礉鍒?SPAN lang=EN-US>mysql鐩綍
create.db.hibernate.properties鏂囦歡涓唴瀹瑰弬鑰冨涓嬶細(xì)
# these properties are used by the build script to create
# a hypersonic database in the build/db directory that contains
# the jbpm tables and a process deployed in there
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/jbpm
hibernate.connection.username=jbpm
hibernate.connection.password=jbpm
hibernate.c3p0.min_size=1
hibernate.c3p0.max_size=3
hibernate.show_sql=true
6. 鍦╦bpm\lib涓嬪垱寤簃ysql鐩綍錛屾斁榪沵ysql鐨刯dbc driver
7.淇敼build.deploy.xml 鏂囦歡涓璫reate.db task
<target name="create.db" depends="declare.jbpm.tasks, db.clean" description="creates a hypersonic database with the jbpm tables and loads the processes in there">
<jbpmschema actions="create" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"/>
<loadidentities file="${basedir}/src/resources/mysql/identity.db.xml" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"/>
<ant antfile="build.xml" target="build.processes" inheritall="false" />
<deploypar properties="${basedir}/src/resources/mysql/create.db.hibernate.properties">
<fileset dir="build" includes="*.par" />
</deploypar>
</target>
鍥犱負(fù) Hibernate 涓嶈兘灝嗗畠鐨?SPAN lang=EN-US>SessionFactory涓?SPAN lang=EN-US>tomcat鐨?SPAN lang=EN-US>jndi 緇戝畾 , 鎴戜滑鐩存帴鍦ㄦ簮鐮佷腑淇敼
9. 鎵撳紑婧愭枃浠?SPAN lang=EN-US> JbpmSessionFactory.java, 鍦?SPAN lang=EN-US> getInstance() 鏂規(guī)硶閲?SPAN lang=EN-US>, 鍒犻櫎涓嬮潰浠g爜
InitialContext initialContext = new InitialContext();
Object o = initialContext.lookup(jndiName);
灝嗕笅闈㈣繖琛?SPAN lang=EN-US>
instance = (JbpmSessionFactory)
PortableRemoteObject.narrow(o, JbpmSessionFactory.class);
鏇挎崲涓?SPAN lang=EN-US> instance = (JbpmSessionFactory)
PortableRemoteObject.narrow(
new JbpmSessionFactory(createConfiguration()), JbpmSessionFactory.class);
10.鍦?SPAN lang=EN-US> createConfiguration(String configResource) 鏂規(guī)硶閲?SPAN lang=EN-US>, 娉ㄩ噴鎺夎繖孌典唬鐮?SPAN lang=EN-US>
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);
}
鍚屾椂鍔犲叆涓嬮潰鐨勪唬鐮?SPAN lang=EN-US>
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");
11.榪欑鏂規(guī)硶闇瑕佸厛寮starter-kit涓殑jboss錛岀劧鍚巄uild websale錛屾渶鍚巇eploy
鍙傝冩枃绔狅細(xì)
http://mdvjiangbin.bokee.com/3185679.html
http://www.aygfsteel.com/znjqolf/archive/2005/12/19/24654.html
榪樻湁濂藉錛屾煡榪囦箣鍚庨兘蹇樹簡閾炬帴浜嗭紝璋㈣阿鍓嶄漢鐨勬葷粨錛?BR>
鏂規(guī)硶浜岋細(xì)
1錛屽湪starter-kit server涓儴緗茬殑jbpm搴旂敤閲岀殑deploy鐩綍涓垱寤簃ysql-ds.xml
鏂囦歡鍐呭鍙傝冨涓嬶細(xì)
<?xml version="1.0" encoding="UTF-8"?>
<!-- The Hypersonic embedded database JCA connection factory config
$Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
<datasource>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>DefaultDS</jndi-name>
<!-- for tcp connection, allowing other processes to use the hsqldb
database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
<connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
-->
<!-- for totally in-memory db, not saved when jboss stops.
The org.jboss.jdbc.HypersonicDatabase mbean necessary
<connection-url>jdbc:hsqldb:.</connection-url>
-->
<!-- for in-process persistent db, saved when jboss stops. The
org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
-->
<connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
<!-- The driver class -->
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- The login and password -->
<user-name>jbpm</user-name>
<password>jbpm</password>
<!--example of how to specify class that determines if exception means connection should be destroyed-->
<!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
<!-- this will be run before a managed connection is removed from the pool for use by a client-->
<!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>5</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>20</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
<!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
<idle-timeout-minutes>0</idle-timeout-minutes>
</local-tx-datasource>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</datasource>
2錛屽垹闄よ鐩綍鏈夊叧hsqldb 璁劇疆datasource鐨勪袱涓獂ml鏂囦歡銆?BR>
3錛宔dit 涓婁竴鐩綍conf涓嬬殑standardjaws.xml涓殑榪欐
<datasource>java:/DefaultDS</datasource>
<type-mapping>mySQL</type-mapping>
璁﹖ype-mapping瀵瑰簲mysql-ds.xml涓殑type-mapping
Step 4: JMS configuration descriptors
a) Remove hsqldb-jdbc2-service.xml from folder deploy/jms. Save this file somewhere else.
b) Copy mysql-jdbc2-service.xml from folder docs/example/jms to deploy/jms.
c) Edit mysql-jdbc2-service.xml and change the datasource name if applicable. In my configuration I don't use HSQL at all so I configured the default datasource DefaultDS for MySQL. In this file, change mySQLDS to DefaultDS. Note that datasource names are case sensitive.
Step 5: Install MySQL Java Connector
Download MySQL Connector/J and place the file mysql-connector-java-3.0.15-ga-bin.jar in the lib folder of the server.
錛侊紒錛佸悓鏃墮渶瑕佷慨鏀筪eploy涓璲bpm.sar鏂囦歡澶歸噷鐨刯bpm.sar.cfg.jar鏂囦歡錛屾洿鏂拌鏂囦歡閲岄潰鐨勬暟鎹簱閰嶇疆
鍙傝冩枃绔狅細(xì)
http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3861605