Terry.Li-彬

虚其心,可解天下之问;专其心,可治天下之学;静其心,可悟天下之理;恒其心,可成天下之业。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  143 随笔 :: 344 文章 :: 130 评论 :: 0 Trackbacks
 

首先,确认手边有一份jbpm3user guide,有一份还有JBPM3.0源码的压缩包

JBPM中是通过org.jbpm.db. JbpmSessionFactory.getInstance()返回一个JbpmSessionFactory实例,

下面通过分析getInstance()的过程,说明怎么设置相关配置文件

1JbpmSessionFactory.getInstance()方法首先查找类路径中的jbpm.properties文件

jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl

jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance

# uncomment the next line if JbpmSessionFactory.getInstance()

# should lookup the singleton instance from JNDI instead of creating

# a default one.

#

jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory

# uncomment the next line to use the file system instead of the database for

# storing files related to a process definition

#

# jbpm.files.dir=c:/jbpm.data

# resource path to a properties file that will overwrite all the hibernate

# properties. For database specific builds in db project there is a different

# hibernate.properties file on the classpath for each database. You could change

# the default database for any testing runs by uncommenting the next line and

# adding a hibernate.properties file in the basedir.

#

jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml

jbpm.hibernate.properties=jbpm.hibernate.properties

找到最基本的设置,jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory

这行表示从jndi获取一个JbpmSessionFactory的一个实例,如果你可以用JBPM3 demojava:/jbpm/JbpmSessionFactory是与DataSource DefaultDS绑定在一起的(在jboss-service.xml中)。要部署在tomcat中,这行必须注释掉。

<?xml version="1.0" encoding="UTF-8"?>

<server>

 <mbean code="org.jbpm.db.jmx.JbpmService"

         name="jboss.jbpm:name=DefaultJbpm,service=JbpmService"

         description="Default jBPM Service">

    <attribute name="JndiName">java:/jbpm/JbpmSessionFactory</attribute>

    <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>

 </mbean>

</server>

jboss-service.xml文件内容,如果你用源码包成功部署了websale的话,可以在JBOSS_HOME"server"jbpm"deploy"jbpm.sar"META-INF"目录下找到该文件

2、如果getInstance()没有找到jbpm.session.factory.jndi.name的值,会继续查找jbpm.hibernate.properties的值,找到jbpm.hibernate.properties的值后,会用该值作为配置文件取创建JbpmSessionFactory

jbpm.hibernate.properties内容:

hibernate.dialect=org.hibernate.dialect.HSQLDialect

hibernate.connection.datasource=java:/DefaultDS

# hibernate.show_sql=true

是用DataSource来创建JbpmSessionFactoryDataSource需要在Server.xml中配置,如果你不想配置DataSource的话,把这行也注释掉

3、上面两项内容都被注释掉的话,getInstance()会查找jbpm.hibernate.cfg.xml的值,用该值作为配置文件创建一个JbpmSessionFactory

说明,这里只是讲了怎么配置相关文件,没有说到怎么部署,关于这方面内容,请参考User Guide chapter 5

posted on 2007-09-06 18:10 礼物 阅读(1854) 评论(0)  编辑  收藏 所属分类: Jbpm