---
title: "spring2.5.4+hibernate3.2.6+struts2+jbpm3.2.2(转载）"
author: "bigtree2006"
date: "2009-02-06T17:08:23Z"
tags: []
slug: "spring2-5-4-hibernate3-2-6-struts2-jbpm3-2-2"
draft: false
lastmod: "2009-02-06T17:08:23Z"
id: 324159
url: "https://bigtree2006.iteye.com/blog/324159"
---

本问转自：[http://blog.csdn.net/gabriel80/archive/2008/05/23/2472237.aspx#967954](http://blog.csdn.net/gabriel80/archive/2008/05/23/2472237.aspx#967954)

1.首先我们要介绍

web.xml文件：

&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;web-app version="2.4" xmlns="[http://java.sun.com/xml/ns/j2ee](http://java.sun.com/xml/ns/j2ee)"  
    xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)"  
    xsi:schemaLocation="[http://java.sun.com/xml/ns/j2ee](http://java.sun.com/xml/ns/j2ee) [http://java.sun.com/xml/ns/j2ee/web-app\_2\_4.xsd](http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd)"&gt;  
   
 &lt;display-name&gt;ForceView Service Desk V3&lt;/display-name&gt;  
 &lt;context-param&gt;  
  &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;  
  &lt;param-value&gt;/WEB-INF/classes/log4j.properties&lt;/param-value&gt;  
 &lt;/context-param&gt;

 &lt;!-- Spring XML 文件读入 --&gt;  
    &lt;context-param&gt;  
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;  
        &lt;param-value&gt;  
   classpath:/applicationContext-resources.xml  
   classpath:/applicationContext-dao.xml  
            /WEB-INF/applicationContext.xml  
  &lt;/param-value&gt;  
    &lt;/context-param&gt;

 &lt;!-- Spring框架中对请求的编码方式进行统一管理 --&gt;  
    &lt;filter&gt;  
        &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;  
        &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;  
        &lt;init-param&gt;  
            &lt;param-name&gt;encoding&lt;/param-name&gt;  
            &lt;param-value&gt;UTF-8&lt;/param-value&gt;  
        &lt;/init-param&gt;  
        &lt;init-param&gt;  
            &lt;param-name&gt;forceEncoding&lt;/param-name&gt;  
            &lt;param-value&gt;true&lt;/param-value&gt;  
        &lt;/init-param&gt;  
    &lt;/filter&gt;  
     
    &lt;!-- 配置Struts2框架的核心Filter --&gt;  
 &lt;filter&gt;  
        &lt;filter-name&gt;struts&lt;/filter-name&gt;  
        &lt;!-- 配置Struts 2核心Filter的实现类 --&gt;  
        &lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher&lt;/filter-class&gt;  
    &lt;/filter&gt;  
    &lt;filter&gt;  
        &lt;filter-name&gt;struts-cleanup&lt;/filter-name&gt;  
        &lt;filter-class&gt;org.apache.struts2.dispatcher.ActionContextCleanUp&lt;/filter-class&gt;  
    &lt;/filter&gt;  
   
 &lt;filter-mapping&gt;  
        &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;  
        &lt;url-pattern&gt;/\*&lt;/url-pattern&gt;  
 &lt;/filter-mapping&gt;  
 &lt;!-- 配置Struts 2的核心FilterDispatcher拦截所有用户请求 --&gt;  
    &lt;filter-mapping&gt;  
        &lt;filter-name&gt;struts&lt;/filter-name&gt;  
        &lt;url-pattern&gt;/\*&lt;/url-pattern&gt;  
        &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;  
        &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;  
    &lt;/filter-mapping&gt;  
    &lt;filter-mapping&gt;  
        &lt;filter-name&gt;struts-cleanup&lt;/filter-name&gt;  
        &lt;url-pattern&gt;/\*&lt;/url-pattern&gt;  
        &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;  
        &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;  
    &lt;/filter-mapping&gt;  
     
 &lt;!-- 启动Spring Listener contextConfigLocation --&gt;  
   &lt;listener&gt;  
     &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;  
   &lt;/listener&gt;  
   &lt;!-- 防止内存泄露 --&gt;    
    &lt;listener&gt;    
        &lt;listener-class&gt;org.springframework.web.util.IntrospectorCleanupListener&lt;/listener-class&gt;    
    &lt;/listener&gt;  
    &lt;listener&gt;  
        &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;  
    &lt;/listener&gt;   
 &lt;!-- Listener log4jConfigLocation --&gt;  
   &lt;listener&gt;  
     &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;  
   &lt;/listener&gt;

 &lt;!-- The Welcome File List --&gt;  
 &lt;welcome-file-list&gt;  
  &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;  
 &lt;/welcome-file-list&gt;  
&lt;/web-app&gt;

2.然后我们介绍

applicationContext\_resources.xml:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "[http://www.springframework.org/dtd/spring-beans.dtd](http://www.springframework.org/dtd/spring-beans.dtd)"&gt;

&lt;beans&gt;  
        
    &lt;!-- For mail settings and future properties files --&gt;  
    &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;  
        &lt;property name="locations"&gt;  
            &lt;list&gt;  
                &lt;value&gt;classpath:jdbc.properties&lt;/value&gt;  
                &lt;value&gt;classpath:mail.properties&lt;/value&gt;  
            &lt;/list&gt;  
        &lt;/property&gt;  
    &lt;/bean&gt;  
    &lt;!-- 配置数据源 使用Apache DBCP 连接池--&gt;  
 &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;  
  &lt;property name="driverClassName" value="${sqlserver.driverClassName}" /&gt;  
  &lt;property name="url" value="${sqlserver.url}" /&gt;  
  &lt;property name="username" value="${sqlserver.username}" /&gt;  
  &lt;property name="password" value="${sqlserver.password}" /&gt;  
  &lt;property name="maxActive" value="100"/&gt;  
        &lt;property name="maxWait" value="1000"/&gt;  
        &lt;property name="poolPreparedStatements" value="true"/&gt;  
        &lt;property name="defaultAutoCommit" value="true"/&gt;  
 &lt;/bean&gt;  
&lt;/beans&gt;

然后这个文件就要使用到辅助文件jdbc.properties：

sqlserver.driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver  
sqlserver.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=AOP\_JBPM;SelectMethod=cursor;  
sqlserver.username=sa  
sqlserver.password=sa

sqlserver.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

mysql.driverClassName=com.mysql.jdbc.Driver  
mysql.url=jdbc:mysql://localhost/itsm?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8  
mysql.username=root  
mysql.password=

mysql.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

3.介绍applicationContext-dao.xml文件：

&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "[http://www.springframework.org/dtd/spring-beans.dtd](http://www.springframework.org/dtd/spring-beans.dtd)"&gt;

&lt;beans&gt;  
    &lt;!-- Hibernate SessionFactory --&gt;  
 &lt;bean id="sessionFactory"  
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;  
  &lt;property name="dataSource" ref="dataSource"/&gt;  
  &lt;property name="typeDefinitions" ref="jbpmTypes"/&gt;  
   &lt;!-- 导入用户自定义的\*.hbm.xml文件 --&gt;  
  &lt;property name="mappingDirectoryLocations"&gt;  
   &lt;list&gt;  
    &lt;value&gt;classpath:/com/dhcc/itsm/&lt;/value&gt;  
   &lt;/list&gt;  
  &lt;/property&gt;  
   &lt;!--  
   throw error:  
   cvc-complex-type.2.3: Element 'list' cannot have character \[children],  
   because the type's content type is element-only.  
  &lt;property name="mappingJarLocations"&gt;  
  　　 &lt;list&gt;  
  　　  &lt;value&gt;WEB-INF/lib/jbpm-jpdl.jar&lt;/value&gt;  
  　　  &lt;value&gt;WEB-INF/lib/jbpm-identity.jar&lt;/value&gt;  
  　　 &lt;/list&gt;  
 　　 &lt;/property&gt;  
   --&gt;  
   &lt;!-- 可以导入包里的所有文件。但是此写法不适用WEBLOGIC  --&gt;  
   &lt;property name="mappingLocations"&gt;    
           &lt;value&gt;classpath\*:/org/jbpm/\*\*/\*.hbm.xml&lt;/value&gt;   
        &lt;/property&gt;  
  &lt;property name="hibernateProperties"&gt;  
   &lt;props&gt;  
    &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.SQLServerDialect&lt;/prop&gt;  
    &lt;prop key="hibernate.show\_sql"&gt;true&lt;/prop&gt;  
    &lt;prop key="hibernate.generate\_statistics"&gt;true&lt;/prop&gt;  
    &lt;prop key="hibernate.cache.use\_second\_level\_cache"&gt;false&lt;/prop&gt;  
    &lt;prop key="hibernate.cache.use\_query\_cache"&gt;false&lt;/prop&gt;  
    &lt;prop key="hibernate.cache.provider\_class"&gt;org.hibernate.cache.HashtableCacheProvider&lt;/prop&gt;  
    &lt;!--  
     为了使HIBERNATE3查询的时候使用正确的语法需要指明查询工厂类,如果不指定回出现  
　　     ClassNotFoundException: org.hibernate.hql.ast.HqlToken 的错误!  
　　    &lt;prop key="hibernate.query.factory\_class"&gt;org.hibernate.hql.ast.ASTQueryTranslatorFactory&lt;/prop&gt;  
     --&gt;  
     &lt;!--  
      Hibernate3.0 采用新的基于ANTLR的HQL/SQL查询翻译器，      
     在Hibernate的配置文件中，hibernate.query.factory\_class      
     属性用来选择查询翻译器。      
     （1）选择Hibernate3.0的查询翻译器：      
     hibernate.query.factory\_class=      
     org.hibernate.hql.ast.ASTQueryTranslatorFactory      
     （2）选择Hibernate2.1的查询翻译器hibernate.query.factory\_class=      
     org.hibernate.hql.classic.ClassicQueryTranslatorFactory      
     --&gt;  
   &lt;/props&gt;  
  &lt;/property&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- JPBM的大字段处理类型 --&gt;  
 &lt;bean id="jbpmTypes" class="org.springframework.orm.hibernate3.TypeDefinitionBean"&gt;  
  &lt;property name="typeName" value="string\_max" /&gt;  
  &lt;property name="typeClass" value="org.jbpm.db.hibernate.StringMax" /&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- 定义processdefinition.xml是否自动发布 --&gt;

 &lt;bean id="processDefinitionFactoryBean"  
    class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean"&gt;  
    &lt;property name="definitionLocation"  
     value="classpath:com/dhcc/itsm/jbpm/process/simple/processdefinition.xml" /&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- 配置spring-modules-jbpm31.jar中提供的JbpmConfiguration --&gt;  
 &lt;bean id="jbpmConfiguration"  
  class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"&gt;  
  &lt;property name="sessionFactory" ref="sessionFactory" /&gt;  
  &lt;property name="configuration" value="classpath:jbpm.cfg.xml" /&gt;  
  &lt;property name="createSchema" value="false" /&gt;  
  &lt;!-- 定义processdefinition.xml是否自动发布 --&gt;  
  &lt;property name="processDefinitions"&gt;  
     &lt;list&gt;  
      &lt;ref local="processDefinitionFactoryBean" /&gt;  
     &lt;/list&gt;  
    &lt;/property&gt;

 &lt;/bean&gt;  
 &lt;bean id="jbpmTemplate"  
  class="org.springmodules.workflow.jbpm31.JbpmTemplate"&gt;  
  &lt;constructor-arg index="0" ref="jbpmConfiguration" /&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- 使用BeanNameAutoProxyCreator的代理方法 --&gt;  
 &lt;!--  
 &lt;bean id="myTransactionManager"        
  class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;  
       &lt;property name="sessionFactory" ref="sessionFactoryForJbpm" /&gt;  
 &lt;/bean&gt;  
 &lt;bean id="beanNameProxy"        
  class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&gt;  
         &lt;property name="beanNames"&gt;  
              &lt;value&gt;\*Manager&lt;/value&gt;  
         &lt;/property&gt;        
         &lt;property name="interceptorNames"&gt;  
           &lt;list&gt;     
            &lt;value&gt;transactionInterceptor&lt;/value&gt;  
           &lt;/list&gt;        
          &lt;/property&gt;    
 &lt;/bean&gt;     
 &lt;bean id="transactionInterceptor"        
  class="org.springframework.transaction.interceptor.TransactionInterceptor"&gt;  
         &lt;property name="transactionManager"&gt;            
          &lt;ref bean="myTransactionManager" /&gt;       
         &lt;/property&gt;        
         &lt;property name="transactionAttributes"&gt;            
         &lt;props&gt;               
         &lt;prop key="\*"&gt;PROPAGATION\_REQUIRED&lt;/prop&gt;            
         &lt;/props&gt;        
         &lt;/property&gt;  
 &lt;/bean&gt;  
  --&gt;  
    
 &lt;!-- TransactionManager 自动创建代理,使用时必须获取实现类,工厂创建代理可以添加所要继承的接口 --&gt;  
 &lt;bean id="transactionProxyFactoryBean"  
  class="org.springframework.aop.framework.ProxyFactoryBean"&gt;  
  &lt;property name="proxyTargetClass"&gt;  
   &lt;value&gt;true&lt;/value&gt;  
  &lt;/property&gt;  
  &lt;property name="singleton"&gt;  
   &lt;value&gt;false&lt;/value&gt;  
  &lt;/property&gt;  
  &lt;property name="interceptorNames"&gt;  
   &lt;list&gt;  
    &lt;value&gt;transactionInterceptor&lt;/value&gt;  
   &lt;/list&gt;  
  &lt;/property&gt;  
 &lt;/bean&gt;  
 &lt;bean id="transactionInterceptor"  
  class="org.springframework.transaction.interceptor.TransactionInterceptor"&gt;  
  &lt;property name="transactionAttributes"&gt;  
   &lt;props&gt;  
    &lt;prop key="find\*"&gt;  
     PROPAGATION\_REQUIRED,ISOLATION\_DEFAULT,readOnly  
    &lt;/prop&gt;  
    &lt;prop key="\*"&gt;  
     PROPAGATION\_REQUIRED,ISOLATION\_DEFAULT,-Exception  
    &lt;/prop&gt;  
   &lt;/props&gt;  
  &lt;/property&gt;  
  &lt;property name="transactionManager"&gt;  
   &lt;ref bean="hibernateTransactionManager" /&gt;  
  &lt;/property&gt;  
 &lt;/bean&gt;  
 &lt;!-- TransactionManager spring拦截器中的事务管理 --&gt;  
 &lt;bean id="hibernateTransactionManager"  
  class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;  
  &lt;property name="sessionFactory"&gt;  
   &lt;ref bean="sessionFactory" /&gt;  
  &lt;/property&gt;  
 &lt;/bean&gt;  
&lt;/beans&gt;

4.最后就是用到用户自定义的applicationContext.xml文件：

&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "[http://www.springframework.org/dtd/spring-beans.dtd](http://www.springframework.org/dtd/spring-beans.dtd)"&gt;  
&lt;beans&gt;  
 &lt;!-- 自定义类 --&gt;  
 &lt;bean id="serviceTemplate" parent="transactionProxyFactoryBean"&gt;  
  &lt;property name="target"&gt;  
   &lt;bean class="com.。。。.service.ServiceTemplate"&gt;  
    &lt;property name="jbpmManage" ref="jbpmManage" /&gt;  
   &lt;/bean&gt;  
  &lt;/property&gt;  
 &lt;/bean&gt;  
 &lt;!-- Add new Managers here --&gt;  
 &lt;bean id="jbpmManage" class="com.。。。。.manage.JbpmManage"&gt;  
  &lt;property name="jbpmDao"&gt;    
            &lt;ref bean="jbpmDao" /&gt;    
        &lt;/property&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- Add new DAOs here --&gt;  
 &lt;bean id="jbpmDao" class="com.。。。。.dao.JbpmDao"&gt;  
  &lt;property name="jbpmTemplate"&gt;    
            &lt;ref bean="jbpmTemplate" /&gt;    
        &lt;/property&gt;  
 &lt;/bean&gt;  
   
 &lt;!-- Add new Actions here --&gt;  
 &lt;bean id="deployProcessDefinition" class="com.。。。.actions.DeployProcessDefinition"&gt;  
  &lt;property name="serviceTemplate" ref="serviceTemplate" /&gt;  
 &lt;/bean&gt;  
 &lt;bean id="startProcess" class="com.。。。。.actions.StartProcess"&gt;  
  &lt;property name="serviceTemplate" ref="serviceTemplate" /&gt;  
 &lt;/bean&gt;  
 &lt;bean id="itsmMemu" class="com.。。。actions.ItsmMemu"&gt;  
  &lt;property name="serviceTemplate" ref="serviceTemplate" /&gt;  
 &lt;/bean&gt;  
 &lt;bean id="processInstanceMemu" class="com.。。。.actions.ProcessInstanceMemu"&gt;  
  &lt;property name="serviceTemplate" ref="serviceTemplate" /&gt;  
 &lt;/bean&gt;  
 &lt;!-- 事务通知 --&gt;  
 &lt;!--  
 &lt;tx:advice id="txAdvice" transaction-manager="hibernateTransactionManager"&gt;    
     &lt;tx:attributes&gt;    
         &lt;tx:method name="get\*" read-only="true"/&gt;    
         &lt;tx:method name="\*" propagation="REQUIRES\_NEW" rollback-for="Exception"/&gt;    
     &lt;/tx:attributes&gt;    
 &lt;/tx:advice&gt;   
   --&gt;    
   
 &lt;!-- aop代理设置 --&gt;   
 &lt;!--   
 &lt;aop:config proxy-target-class="true"&gt;    
     &lt;aop:pointcut id="txPointcut" expression="execution(* com...\*Service.\*(..))"/&gt;    
     &lt;aop:pointcut id="logPointcut" expression="execution(* com.r..\*Service.\*(..))"/&gt;    
     &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" order="1"/&gt;    
     &lt;aop:aspect id="logAspect" ref="logInterceptor" order="2" &gt;    
         &lt;aop:after-throwing    
             pointcut-ref="logPointcut"     
             method="serviceIntercept" /&gt;    
     &lt;/aop:aspect&gt;    
 &lt;/aop:config&gt;  
 --&gt;   
   
&lt;/beans&gt;

5.介绍JBPM的配置信息jbpm.cfg.xml：在这里我们应该注意我们用到的是SPRING .所以我就没有用HIBRENATE来产生sessionFactory。。

&lt;jbpm-configuration&gt;

  &lt;!--  
    The default configurations can be found in org/jbpm/default.jbpm.cfg.xml  
    Those configurations can be overwritten by putting this file called  
    jbpm.cfg.xml on the root of the classpath and put in the customized values.  
  --&gt;  
   
  &lt;jbpm-context&gt;  
    &lt;service name="tx" factory="org.jbpm.tx.TxServiceFactory" /&gt;  
    &lt;!--  
    &lt;service name="persistence"&gt;  
     &lt;factory&gt;  
      &lt;bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory"&gt;  
       &lt;field name="isTransactionEnabled"&gt;    
              &lt;false /&gt;    
          &lt;/field&gt;    
          &lt;field name="isCurrentSessionEnabled"&gt;    
              &lt;true/&gt;    
          &lt;/field&gt;  
         &lt;/bean&gt;  
        &lt;/factory&gt;  
    &lt;/service&gt;  
    --&gt;  
    &lt;service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" /&gt;  
    &lt;service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" /&gt;  
    &lt;service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" /&gt;  
    &lt;service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" /&gt;  
    &lt;service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" /&gt;  
  &lt;/jbpm-context&gt;

 &lt;--&lt;string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" /&gt;--&gt;  
  &lt;!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar --&gt;  
  &lt;string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" /&gt;  
  &lt;string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" /&gt;  
  &lt;string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" /&gt;  
  &lt;string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" /&gt;  
  &lt;string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" /&gt;  
  &lt;string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" /&gt;  
  &lt;string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" /&gt;  
  &lt;string name="resource.mail.templates" value="jbpm.mail.templates.xml" /&gt;

  &lt;long name="jbpm.msg.wait.timout" value="5000" singleton="true" /&gt; &lt;!-- 5 seconds --&gt;  
  &lt;int    name="jbpm.byte.block.size" value="1024" singleton="true" /&gt;  
  &lt;bean   name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" /&gt;  
  &lt;bean   name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" /&gt;  
  &lt;string name="jbpm.mail.smtp.host" value="localhost" /&gt;  
  &lt;bean   name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" /&gt;  
   
  &lt;bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor"&gt;  
    &lt;field name="jbpmConfiguration"&gt;&lt;ref bean="jbpmConfiguration" /&gt;&lt;/field&gt;  
    &lt;field name="name"&gt;&lt;string value="JbpmJobExector" /&gt;&lt;/field&gt;  
    &lt;field name="nbrOfThreads"&gt;&lt;int value="1" /&gt;&lt;/field&gt;  
    &lt;field name="idleInterval"&gt;&lt;int value="5000" /&gt;&lt;/field&gt;  
    &lt;field name="maxIdleInterval"&gt;&lt;int value="3600000" /&gt;&lt;/field&gt;  
    &lt;field name="historyMaxSize"&gt;&lt;int value="20" /&gt;&lt;/field&gt;  
    &lt;field name="maxLockTime"&gt;&lt;int value="600000" /&gt;&lt;/field&gt;  
    &lt;field name="lockMonitorInterval"&gt;&lt;int value="60000" /&gt;&lt;/field&gt;  
    &lt;field name="lockBufferTime"&gt;&lt;int value="5000" /&gt;&lt;/field&gt;  
  &lt;/bean&gt;  
   
&lt;/jbpm-configuration&gt;

6.hibernate.cfg.xml文件。。我置空。。

&lt;hibernate-configuration&gt;  
    &lt;session-factory&gt;  
    &lt;/session-factory&gt;  
&lt;/hibernate-configuration&gt;

 

7.介绍struts2的配置文件struts.xml：

&lt;?xml version="1.0" encoding="UTF-8" ?&gt;  
&lt;!DOCTYPE struts PUBLIC  
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  
    "[http://struts.apache.org/dtds/struts-2.0.dtd](http://struts.apache.org/dtds/struts-2.0.dtd)"&gt;

&lt;struts&gt;  
    &lt;constant name="struts.devMode" value="false"/&gt;  
    &lt;constant name="struts.i18n.encoding" value="UTF-8"/&gt;  
    &lt;constant name="struts.action.extension" value="html"/&gt;  
    &lt;constant name="struts.objectFactory" value="spring"/&gt;  
    &lt;constant name="struts.custom.i18n.resources" value="ApplicationResources,errors"/&gt;  
    &lt;constant name="struts.multipart.maxSize" value="2097152"/&gt;  
    &lt;constant name="struts.ui.theme" value="css\_xhtml"/&gt;  
    &lt;constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/"/&gt;  
    &lt;constant name="struts.enable.SlashesInActionNames" value="true"/&gt;   
    &lt;include file="struts\_itsm.xml" /&gt;  
    &lt;!-- Add packages here --&gt;  
   

&lt;/struts&gt;

8.然后会用到struts\_itsm.xml文件：

&lt;?xml version="1.0" encoding="UTF-8" ?&gt;  
&lt;!DOCTYPE struts PUBLIC  
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  
        "[http://struts.apache.org/dtds/struts-2.0.dtd](http://struts.apache.org/dtds/struts-2.0.dtd)"&gt;

&lt;struts&gt;  
 &lt;!-- package提供了将多个Action组织为一个模块的方式  
        package的名字必须是唯一的 package可以扩展 当一个package扩展自  
        另一个package时该package会在本身配置的基础上加入扩展的package  
        的配置 父package必须在子package前配置  
        name：package名称  
        extends:继承的父package名称  
        abstract:设置package的属性为抽象的 抽象的package不能定义action 值true:false  
        namespace:定义package命名空间 该命名空间影响到url的地址，例如此命名空间为/test那么访问是的地址为[http://localhost:8080/struts2/test/XX.action](http://localhost:8080/struts2/test/XX.action)  
     --&gt;  
      
    &lt;package name="itsm" extends="struts-default"&gt;  
        &lt;action name="ItsmMemu" class="com.。。。.actions.ItsmMemu"&gt;  
            &lt;result&gt;/itsm/ItsmMemu.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="\*" class="com.。。。.actions.ItsmMemu"&gt;  
            &lt;result&gt;/itsm/{1}.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="ChooseProcessDefinition" class="com.。。。.actions.ChooseProcessDefinition"&gt;  
            &lt;result&gt;/itsm/ChooseProcessDefinition.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="DeployProcessDefinition" class="com.。。。.actions.DeployProcessDefinition"&gt;  
            &lt;result name="input"&gt;/itsm/Missing.jsp&lt;/result&gt;  
            &lt;result name="success" type="redirect-action"&gt;ItsmMemu&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="ProcessInstanceMemu" class="com.。。。.actions.ProcessInstanceMemu"&gt;  
            &lt;result&gt;/itsm/ProcessInstanceMemu.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="StartProcess" class="com。。。.actions.StartProcess"&gt;  
            &lt;result&gt;/itsm/StartProcess.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;action name="NextProcess" class="com.。。。.actions.NextProcess"&gt;  
            &lt;result&gt;/itsm/NextProcess.jsp&lt;/result&gt;  
        &lt;/action&gt;  
        &lt;!-- Add actions here --&gt;  
    &lt;/package&gt;  
&lt;/struts&gt;  
当然首页INDEX.JSP就不重复了啊

9.当然如果用到上诉框架。肯定是不能缺少一些JAR包的。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/gabriel80/jar%E5%8C%85.JPG)

这样就可以把上诉框架配置完毕。。