整合SSH(Struts2、Spring、Hibernate)和JBPM4.4

1、前提:ssh已经搭建好。

2、导入jbpm.jar   和mail.jar到lib目录中,并且build path

3、将juel-api.jar、juel-engine.jar、juel-impl.jar三个jar包放到tomcat安装目录下的lib文件夹下,并将其自带的el-api.jar删除

4、src目录下建立jbpm.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>  
<jbpm-configuration>  
    <process-engine-context>  
        <string name="spring.cfg" value="applicationContext.xml" />  
    </process-engine-context> 
    <import resource="jbpm.default.cfg.xml" />  
    <import resource="jbpm.tx.spring.cfg.xml" />  
    <import resource="jbpm.jpdl.cfg.xml" />  
    <import resource="jbpm.bpmn.cfg.xml" />  
    <import resource="jbpm.identity.cfg.xml" />  
    <import resource="jbpm.businesscalendar.cfg.xml" />  
    <import resource="jbpm.console.cfg.xml" /> 
    <import resource="jbpm.spring.default.cfg.xml"/> 
    <!--    
    <import resource="jbpm.jobexecutor.cfg.xml" />  
    -->  
</jbpm-configuration>


 

5、src目录下建立jbpm.spring.default.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>  
  
<jbpm-configuration>  
  
  <process-engine-context>  
  
    <repository-service />  
    <repository-cache />  
    <execution-service />  
    <history-service />  
    <management-service />  
    <identity-service />  
    <task-service />  
<!--  
    <hibernate-configuration>  
      <cfg resource="jbpm.hibernate.cfg.xml" />  
    </hibernate-configuration>  
  
    <hibernate-session-factory />  
-->  
    <script-manager default-expression-language="juel"  
                    default-script-language="juel"  
                    read-contexts="execution, environment, process-engine"  
                    write-context="">  
      <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />  
    </script-manager>  
  
    <authentication />  
  
    <id-generator />  
    <types resource="jbpm.variable.types.xml" />  
  
    <address-resolver />  
  
    <business-calendar>  
      <monday    hours="9:00-12:00 and 12:30-17:00"/>  
      <tuesday   hours="9:00-12:00 and 12:30-17:00"/>  
      <wednesday hours="9:00-12:00 and 12:30-17:00"/>  
      <thursday  hours="9:00-12:00 and 12:30-17:00"/>  
      <friday    hours="9:00-12:00 and 12:30-17:00"/>  
      <holiday period="01/07/2008 - 31/08/2008"/>  
    </business-calendar>  
  
    <mail-template name='task-notification'>  
      <to users="${task.assignee}"/>  
      <subject>${task.name}</subject>  
      <text><![CDATA[Hi ${task.assignee}, 
Task "${task.name}" has been assigned to you. 
${task.description} 
 
Sent by JBoss jBPM 
]]></text>  
    </mail-template>  
  
    <mail-template name='task-reminder'>  
      <to users="${task.assignee}"/>  
      <subject>${task.name}</subject>  
      <text><![CDATA[Hey ${task.assignee}, 
Do not forget about task "${task.name}". 
${task.description} 
 
Sent by JBoss jBPM 
]]></text>  
    </mail-template>  
  
  </process-engine-context>  
  
  <transaction-context>  
    <repository-session />  
    <db-session />  
  
    <message-session />  
    <timer-session />  
    <history-session />  
    <mail-session>  
      <mail-server>  
        <session-properties resource="jbpm.mail.properties" />  
      </mail-server>  
    </mail-session>  
  </transaction-context>  
  
</jbpm-configuration>  


 

6、applicationContext.xml中加入springHelper配置,作为jbpm processEngine的factory bean

<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
		<property name="jbpmCfg" value="jbpm.cfg.xml" />
	</bean>


 

7、applicationContext.xml中加入processEngine配置,并以此为factory bean创建JBPM本身的各种Service

<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine"  />
	
	<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
	<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService"/>
	<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>
	<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
	<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>


 

8、applicationContext.xml的hibernate配置中加入jbpm所需的hbm.xml配置

<property name="mappingLocations">
			<list>
				<value>classpath:jbpm.execution.hbm.xml</value>
				<value>classpath:jbpm.history.hbm.xml</value>
				<value>classpath:jbpm.identity.hbm.xml</value>
				<value>classpath:jbpm.repository.hbm.xml</value>
				<value>classpath:jbpm.task.hbm.xml</value>
			</list>
		</property>


 

完成

 

我的eclipse项目目录:

 

展开阅读全文

Struts2+Spring3+Hibernate4+JBPM4.4整合问题

07-31
<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>jar包</p> <p><img src="http://dl2.iteye.com/upload/attachment/0087/6822/e8e1a7c1-2a73-3229-8406-20255161b36c.jpg" alt="" width="763" height="216"><br>Spring 配置文件<br><br>//新添加的 整合 JBPM<br> <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper"><br>   <property name="jbpmCfg" value="jbpm.cfg.xml" /><br> </bean><br><br> <bean id="processEngine" factory-bean="springHelper"  factory-method="createProcessEngine" /><br><br><!-- 配置hibernate session工厂 --><br> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"><br>   <property name="dataSource" ref="dataSource" /><br> // 自动注入 jbpm表<br>   <property name="mappingLocations">  <br>     <list>  <br>      <value>classpath:jbpm.execution.hbm.xml</value><br>      <value>classpath:jbpm.history.hbm.xml</value><br>      <value>classpath:jbpm.identity.hbm.xml</value><br>      <value>classpath:jbpm.repository.hbm.xml</value><br>      <value>classpath:jbpm.task.hbm.xml</value><br>        </list><br>    </property><br><br>jbpm.cfg.xml 配置文件内容<br> <?xml version="1.0" encoding="UTF-8"?><br> <jbpm-configuration><br> <process-engine-context><br>     <string name="spring.cfg" value="spring-jbpm4.xml" /><br>   </process-engine-context><br> <import resource="jbpm.default.cfg.xml" /><br> <import resource="jbpm.tx.spring.cfg.xml" /><br> <import resource="jbpm.jpdl.cfg.xml" /><br> <import resource="jbpm.bpmn.cfg.xml" /><br> <import resource="jbpm.identity.cfg.xml" /><br> <import resource="jbpm.businesscalendar.cfg.xml" /><br> <import resource="jbpm.console.cfg.xml" /><br> </jbpm-configuration><br><br>启动之后的报错信息:<br><br>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in class path resource [spring-hibernate.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/impl/SessionImpl<br> at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)<br> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)<br> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)<br> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)<br> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)<br> at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)<br> at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)<br> at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)<br> at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)<br> at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)<br> at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)<br> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)<br> at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)<br> at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)<br> at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)<br> at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)<br> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)<br> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)<br> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)<br> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)<br> at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)<br> at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)<br> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)<br> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)<br> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)<br> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)<br> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)<br> at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)<br> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)<br> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)<br> at org.apache.catalina.core.StandardService.start(StandardService.java:516)<br> at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)<br> at org.apache.catalina.startup.Catalina.start(Catalina.java:578)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:597)<br> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)<br> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)<br> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/impl/SessionImpl<br> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:169)<br> at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)<br> ... 38 more<br> Caused by: java.lang.NoClassDefFoundError: org/hibernate/impl/SessionImpl<br> at org.jbpm.pvm.internal.wire.descriptor.HibernateSessionDescriptor.getType(HibernateSessionDescriptor.java:95)<br> at org.jbpm.pvm.internal.wire.WireDefinition.addDescriptor(WireDefinition.java:88)<br> at org.jbpm.pvm.internal.wire.xml.WireParser.parseDocumentElement(WireParser.java:208)<br> at org.jbpm.pvm.internal.cfg.ConfigurationParser.parseDocument(ConfigurationParser.java:112)<br> at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:432)<br> at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:158)<br> at org.jbpm.pvm.internal.cfg.ConfigurationParser.parseDocument(ConfigurationParser.java:86)<br> at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:432)<br> at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:158)<br> at org.jbpm.pvm.internal.cfg.ConfigurationImpl.parse(ConfigurationImpl.java:137)<br> at org.jbpm.pvm.internal.cfg.ConfigurationImpl.setResource(ConfigurationImpl.java:116)<br> at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(SpringHelper.java:50)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:597)<br> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)<br> ... 39 more<br> Caused by: java.lang.ClassNotFoundException: org.hibernate.impl.SessionImpl<br> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)<br> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)<br> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)<br> ... 56 more<br> 2013-7-31 11:13:06 org.apache.catalina.core.StandardContext listenerStart</p> <p> </p> </div>
©️2020 CSDN 皮肤主题: Age of Ai 设计师: meimeiellie 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值