JBPM3.2GA 整合SSH

【转】JBPM3.2GA整合SSH.

2011-03-0418:53177人阅读评论(0)收藏举报

之前本来用的是JBPM4.4的,并且SSH都整合好了,当时我们公司产品为了兼容性考虑用的是JDK1.4,JBPM4.4至少是需要JDK5以上的版本的。所以就将JBPM版本换成了3.2GA(http://sourceforge.net/上有下载),在将JBPM3.2GA和Spring1.2+Hibernate3.1+webwork2整合的时候遇到了不少麻烦,上网收集了很多资料,在这里总结一下,帮助那些JBPM的初学者和方便以后查阅。

在这里需要四个Jar包,spring-modules-jbpm*.jar,jbpm-3.2GA.jar,jbpm-identity.jar,bsh.jar。

1,在applicationContext.xml中这么配置

<beanid="jbpmConfiguration"class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"><propertyname="sessionFactory"ref="sessionFactory"/><propertyname="configuration"value="classpath:jbpm.cfg.xml"/></bean><beanid="jbpmTemplate"class="org.springmodules.workflow.jbpm31.JbpmTemplate"><propertyname="jbpmConfiguration"ref="jbpmConfiguration"></property></bean>这样我们就可以通过依赖注入,在程序中使用jbpmConfiguration和jbpmTemplate了。

2,在applicationContext.xml中,我们可以看到jbpmConfiguration是需要依赖jbpm.cfg.xml的(<propertyname="configuration"value="classpath:jbpm.cfg.xml"/>)

这个文件我们可以在jbpm-3.2GA.jar中找到(在包org.jbpm下default.jbpm.cfg.xml),由于我们的数据库配置是在hibernate.cfg.xml(或者是applicationContext.xml)中配置好了的,

所以我们需要将org.jbpm下的default.jbpm.cfg.xml复制出来,然后去掉其中的一句话<stringname="resource.hibernate.cfg.xml"value="hibernate.cfg.xml"/>就可以了。然后将其重命名为jbpm.cfg.xml放在src目录下,如果没有这个文件的话,jbpm会默认调用org.jbpm下的default.jbpm.cfg.xml。

修改之后的jbpm.cfg.xml如下

<jbpm-configuration><!--Thisconfigurationisusedwhenthereisnojbpm.cfg.xmlfilefoundintherootoftheclasspath.Itisaverybasicconfigurationwithoutpersistenceandmessageservices.Onlytheauthorizationserviceinstalled.Youcanparseandcreateprocesses,butwhenyoutrytouseoneoftheunavailableservices,you'llgetanexception.--><jbpm-context><servicename="persistence"factory="org.jbpm.persistence.db.DbPersistenceServiceFactory"/><servicename="tx"factory="org.jbpm.tx.TxServiceFactory"/><servicename="message"factory="org.jbpm.msg.db.DbMessageServiceFactory"/><servicename="scheduler"factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory"/><servicename="logging"factory="org.jbpm.logging.db.DbLoggingServiceFactory"/><servicename="authentication"factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"/></jbpm-context><!--configurationpropertyusedbypersistenceserviceimplorg.jbpm.persistence.db.DbPersistenceServiceFactory--><!--<stringname="resource.hibernate.cfg.xml"value="hibernate.cfg.xml"/>--><!--configurationresourcefilespointingtodefaultconfigurationfilesinjbpm-{version}.jar--><stringname="resource.business.calendar"value="org/jbpm/calendar/jbpm.business.calendar.properties"/><stringname="resource.default.modules"value="org/jbpm/graph/def/jbpm.default.modules.properties"/><stringname="resource.converter"value="org/jbpm/db/hibernate/jbpm.converter.properties"/><stringname="resource.action.types"value="org/jbpm/graph/action/action.types.xml"/><stringname="resource.node.types"value="org/jbpm/graph/node/node.types.xml"/><stringname="resource.parsers"value="org/jbpm/jpdl/par/jbpm.parsers.xml"/><stringname="resource.varmapping"value="org/jbpm/context/exe/jbpm.varmapping.xml"/><stringname="resource.mail.templates"value="jbpm.mail.templates.xml"/><intname="jbpm.byte.block.size"value="1024"singleton="true"/><beanname="jbpm.task.instance.factory"class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"singleton="true"/><beanname="jbpm.variable.resolver"class="org.jbpm.jpdl.el.impl.JbpmVariableResolver"singleton="true"/><stringname="jbpm.mail.smtp.host"value="localhost"/><beanname="jbpm.mail.address.resolver"class="org.jbpm.identity.mail.IdentityAddressResolver"singleton="true"/><stringname="jbpm.mail.from.address"value="jbpm@noreply"/><beanname="jbpm.job.executor"class="org.jbpm.job.executor.JobExecutor"><fieldname="jbpmConfiguration"><refbean="jbpmConfiguration"/></field><fieldname="name"><stringvalue="JbpmJobExecutor"/></field><fieldname="nbrOfThreads"><intvalue="1"/></field><fieldname="idleInterval"><intvalue="5000"/></field><fieldname="maxIdleInterval"><intvalue="3600000"/></field><!--1hour--><fieldname="historyMaxSize"><intvalue="20"/></field><fieldname="maxLockTime"><intvalue="600000"/></field><!--10minutes--><fieldname="lockMonitorInterval"><intvalue="60000"/></field><!--1minute--><fieldname="lockBufferTime"><intvalue="5000"/></field><!--5seconds--></bean></jbpm-configuration>3,添加jbpm数据表的映射文件。

在applicationContext.xml添加如下配置,这里就不详细描述了,会hibernate,spring的同学都应该很熟悉了。直接贴代码:

   <value>org/jbpm/graph/def/Action.hbm.xml</value><value>org/jbpm/graph/action/Script.hbm.xml</value><value>org/jbpm/db/hibernate.queries.hbm.xml</value><value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value><value>org/jbpm/graph/def/Node.hbm.xml</value><value>org/jbpm/graph/def/Transition.hbm.xml</value><value>org/jbpm/graph/def/Event.hbm.xml</value><value>org/jbpm/graph/def/SuperState.hbm.xml</value><value>org/jbpm/graph/def/ExceptionHandler.hbm.xml</value><value>org/jbpm/instantiation/Delegation.hbm.xml</value><value>org/jbpm/graph/node/StartState.hbm.xml</value><value>org/jbpm/graph/node/EndState.hbm.xml</value><value>org/jbpm/graph/node/ProcessState.hbm.xml</value><value>org/jbpm/graph/node/Decision.hbm.xml</value><value>org/jbpm/graph/node/Fork.hbm.xml</value><value>org/jbpm/graph/node/Join.hbm.xml</value><value>org/jbpm/graph/node/State.hbm.xml</value><value>org/jbpm/graph/node/TaskNode.hbm.xml</value><value>org/jbpm/context/def/ContextDefinition.hbm.xml</value><value>org/jbpm/context/def/VariableAccess.hbm.xml</value><value>org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml</value><value>org/jbpm/taskmgmt/def/Swimlane.hbm.xml</value><value>org/jbpm/taskmgmt/def/Task.hbm.xml</value><value>org/jbpm/taskmgmt/def/TaskController.hbm.xml</value><value>org/jbpm/module/def/ModuleDefinition.hbm.xml</value><value>org/jbpm/bytes/ByteArray.hbm.xml</value><value>org/jbpm/file/def/FileDefinition.hbm.xml</value><value>org/jbpm/scheduler/def/CreateTimerAction.hbm.xml</value><value>org/jbpm/scheduler/def/CancelTimerAction.hbm.xml</value><value>org/jbpm/graph/exe/Comment.hbm.xml</value><value>org/jbpm/graph/exe/ProcessInstance.hbm.xml</value><value>org/jbpm/graph/exe/Token.hbm.xml</value><value>org/jbpm/graph/exe/RuntimeAction.hbm.xml</value><value>org/jbpm/module/exe/ModuleInstance.hbm.xml</value><value>org/jbpm/context/exe/ContextInstance.hbm.xml</value><value>org/jbpm/context/exe/TokenVariableMap.hbm.xml</value><value>org/jbpm/context/exe/VariableInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml</value><value>org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml</value><!--jobmappingfiles--><value>org/jbpm/job/Job.hbm.xml</value><value>org/jbpm/job/Timer.hbm.xml</value><value>org/jbpm/job/ExecuteNodeJob.hbm.xml</value><value>org/jbpm/job/ExecuteActionJob.hbm.xml</value><value>org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml</value><value>org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml</value><value>org/jbpm/taskmgmt/exe/PooledActor.hbm.xml</value><value>org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml</value><value>org/jbpm/logging/log/ProcessLog.hbm.xml</value><value>org/jbpm/logging/log/MessageLog.hbm.xml</value><value>org/jbpm/logging/log/CompositeLog.hbm.xml</value><value>org/jbpm/graph/log/ActionLog.hbm.xml</value><value>org/jbpm/graph/log/NodeLog.hbm.xml</value><value>org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml</value><value>org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml</value><value>org/jbpm/graph/log/ProcessStateLog.hbm.xml</value><value>org/jbpm/graph/log/SignalLog.hbm.xml</value><value>org/jbpm/graph/log/TokenCreateLog.hbm.xml</value><value>org/jbpm/graph/log/TokenEndLog.hbm.xml</value><value>org/jbpm/graph/log/TransitionLog.hbm.xml</value><value>org/jbpm/context/log/VariableLog.hbm.xml</value><value>org/jbpm/context/log/VariableCreateLog.hbm.xml</value><value>org/jbpm/context/log/VariableDeleteLog.hbm.xml</value><value>org/jbpm/context/log/VariableUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml</value><value>org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/TaskLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml</value><value>org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml</value>现在所有的配置都已经OK了!

下面我把那4个jar包也上传一下,建议使用我上传的jar包,要不然可能会出错的!

现在地址:http://files.cnblogs.com/gaoyoubo/jbpm.rar

相关推荐