最近项目在WAS环境下部署测试中,发现一个怪异的问题,在Tomcat下面跑的好好的系统,换到WAS环境,竟然在系统登录时抛了个 proxy handle is no longer valid的错误:
nested exception is org.hibernate.HibernateException: proxy handle is no longer valid at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:206) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:606) at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:488) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
开始以为是自己的事务配置有问题导致的,于是关闭掉了事务声明的地方,结果出乎意料,竟然正常了,不过系统不能不要事务处理啊
我系统配置是Spring3.1+hibernate4.1.2,was版本是7.0.0.23
spring.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 4 xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" 5 xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" 6 xsi:schemaLocation=" 7 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 8 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 9 http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd 10 http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd 11 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd 12 http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" 13 default-autowire="byName" default-lazy-init="true"> 14 15 <!-- 数据源配置, 使用proxool数据库连接池 --> 16 <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> 17 <property name="driver" value="${jdbc.driverClassName}" /> 18 <property name="driverUrl" value="${jdbc.url}" /> 19 <property name="user" value="${jdbc.username}" /> 20 <property name="password" value="${jdbc.password}" /> 21 <property name="alias" value="${jdbc.alias}" /> 22 <property name="maximumActiveTime" value="1800000" /> 23 <property name="prototypeCount" value="1" /> 24 <property name="maximumConnectionCount" value="200" /> 25 <property name="minimumConnectionCount" value="1" /> 26 <property name="houseKeepingTestSql" value="${dataSource.houseKeepingTestSql}"/> 27 <property name="trace" value="false" /> 28 </bean> 29 30 32 <!-- Hibernate SessionFactory --> 33 <bean id="sessionFactory" 34 class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 35 <property name="dataSource" ref="dataSource" /> 36 <property name="hibernateProperties"> 37 <props> 38 <prop key="hibernate.dialect">${hibernate.dialect}</prop> 39 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> 40 <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> 41 <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop> 42 <prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop> 43 <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop> 44 <prop key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop> 45 <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> 46 <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop> 47 <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop> 48 <!--<prop key="hibernate.cache.provider_configuration_file_resource_path">/cache/ehcache-hibernate-local.xml</prop> 49 c3p0 connection pool config <prop key="hibernate.connection.provider_class">${hibernate.connection.provider_class}</prop> --> 50 <!-- unit test open it <prop key="hibernate.hbm2ddl.auto"> ${hibernate.hbm2ddl.auto}</prop> --> 51 </props> 52 </property> 53 <property name="mappingDirectoryLocations"> 54 <list> 55 <value>classpath*:com/entity</value> 56 </list> 57 </property> 58 </bean> 59 60 61 <!-- Transaction manager for a single Hibernate SessionFactory (alternative 62 to JTA) --> 63 <bean id="transactionManager" 64 class="org.springframework.orm.hibernate4.HibernateTransactionManager"> 65 <property name="sessionFactory" ref="sessionFactory" /> 66 </bean> 67 68 <!-- 定义事务管理器(声明式的事务) --> 69 <bean id="transactionInterceptor" 70 class="org.springframework.transaction.interceptor.TransactionInterceptor"> 71 <property name="transactionManager" ref="transactionManager" /> 72 <!-- 配置事务属性 --> 73 <property name="transactionAttributes"> 74 <props> 75 <prop key="add*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 76 </prop> 77 <prop key="recovery*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 78 </prop> 79 <prop key="alter*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 80 </prop> 81 <prop key="edit*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 82 </prop> 83 <prop key="batch*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 84 </prop> 85 <prop key="change*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 86 </prop> 87 <prop key="compare*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 88 </prop> 89 <prop key="create*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 90 </prop> 91 <prop key="delete*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 92 </prop> 93 <prop key="del*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 94 </prop> 95 <prop key="execute*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 96 </prop> 97 <prop key="export*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 98 </prop> 99 <prop key="gen*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 100 </prop> 101 <prop key="import*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 102 </prop> 103 <prop key="insert*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 104 </prop> 105 <prop key="promulgate*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 106 </prop> 107 <prop key="publish*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 108 </prop> 109 <prop key="release*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 110 </prop> 111 <prop key="reset*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 112 </prop> 113 <prop key="save*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 114 </prop> 115 <prop key="execute*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 116 </prop> 117 <prop key="modify*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 118 </prop> 119 <prop key="activate*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 120 </prop> 121 <prop key="grant*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 122 </prop> 123 <prop key="ungrant*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 124 </prop> 125 <prop key="syn*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 126 </prop> 127 <prop key="update*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 128 </prop> 129 <prop key="version*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 130 </prop> 131 <prop key="disEnable*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 132 </prop> 133 <prop key="enable*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 134 </prop> 135 <prop key="write*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 136 </prop> 137 <prop key="check*">PROPAGATION_REQUIRED,readOnly</prop> 138 <prop key="count*">PROPAGATION_REQUIRED,readOnly</prop> 139 <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> 140 <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> 141 <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> 142 <prop key="output*">PROPAGATION_REQUIRED,readOnly</prop> 143 <prop key="parse*">PROPAGATION_REQUIRED,readOnly</prop> 144 <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> 145 <prop key="show*">PROPAGATION_REQUIRED,readOnly</prop> 146 </props> 147 </property> 148 </bean> 149 150 <!-- 注册自动代理创建,为业务Bean添加事务拦截器 --> 151 <bean 152 class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> 153 <property name="beanNames"> 154 <list> 155 <value>*Service</value> 156 </list> 157 </property> 158 <property name="interceptorNames"> 159 <list> 160 <!-- 事务控制 --> 161 <value>transactionInterceptor</value> 162 </list> 163 </property> 164 </bean> 165 166 </beans>
检查了一下,没有问题。。。怎么办?
- 思路1:修改事务配置
谷歌一下,有很多人说是WAS自己接管事务的问题,可以参考帖子:
http://www.ibm.com/developerworks/cn/websphere/techjournal/0609_alcott/0609_alcott.html
摘要如下:
使用 Spring 处理事务 WebSphere Application Server 为事务处理和管理与资源提供者的连接提供了一个稳健和可伸缩的环境。无论是否在使用全局事务,与 JDBC、JMS 和 Java Connector 资源适配器的连接均由 WebSphere Application Server 管理;甚至在缺少全局事务时,始终存在一个运行时上下文,在该上下文中可以访问所有资源提供者连接。WebSphere Application Server 将此运行时上下文称为本地事务容器 (LTC) 作用域;在缺少全局事务时始终存在一个 LTC,并且无论是存在全局事务还是 LTC,资源访问始终由运行时管理。为确保事务上下文管理的完整性,以便可以正确管理事务资源,WebSphere Application Server 不向 WebSphere Application Server 中部署的应用程序或应用程序框架公开 javax.transaction.TransactionManager 接口。 在 Spring 中,有许多方法可以驱动事务控制下的资源更新,这包括编程形式和声明形式。声明形式包括 Java Annotation 和 XML 描述符形式。如果将 Spring 2.5 与 WebSphere Application Server V6.0.2.19 或 V6.1.0.9 或者更高版本一起使用,则可以利用对 Spring 的声明式事务模型的完全支持。Spring 2.5 有一个新的用于 WebSphere Application Server 的 PlatformTransactionManager 类,名为 WebSphereUowTransactionManager。该类利用 WebSphere Application Server 的受支持 UOWManager 接口进行事务上下文管理。通过 WebSphere Application Server 的 UOWManager 类管理事务划分可以确保在访问资源提供者时始终可以使用适当的全局事务或 LTC 上下文。不过,早期版本的 Spring 使用了内部 WebSphere 接口,以牺牲 Web 和 EJB 容器功能为代价来管理资源,并且不支持由应用程序使用。这会使容器处于未知状态,从而有可能导致数据损坏。 Spring 2.5 或更高版本中的声明式事务划分在 WebSphere Application Server 中受支持,它使用下面的声明提供对 WebSphere 事务的支持: <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/> 引用此声明的 Spring Bean 然后将使用标准 Spring 依赖项注入来使用事务支持,例如: <bean id="someBean" class="some.class"> <property name="transactionManager" > <ref bean="transactionManager"/> </property> </bean> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> 或者,在 Spring 2.5 以后的版本中,可以利用 Spring 的 AspectJ 支持。在下面的示例中,可以将 <tx:advice/> 应用于应用程序的各个部分。这指示所有以“get”开头的方法都是 PROPAGATION_REQUIRED,并且所有以“set”开头的方法都是 PROPAGATION_REQUIRES_NEW。所有其他方法使用缺省事务设置。 <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="set*" propagation="REQUIRES_NEW" /> <tx:method name="*" /> </tx:attributes> </tx:advice> <aop:config/> 标记将那些设置应用于类 MyService 中定义的任何已执行操作。 <aop:config> <aop:pointcut id="myServiceOperation" expression="execution(* sample.service.MyService.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="myServiceOperation"/> </aop:config>
好了,按照以上的说明,修改transactionManager配置,改为
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
重新部署,启动就报错了
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.transaction.jta.WebSphereUowTransactionManager] to required type [javax.transaction.TransactionManager] for property 'transactionManager': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
查询WebSphereUowTransactionManager的API,发现人家根本不是来自于javax.transaction.TransactionManager
好了,这条路看来不通,继续谷歌。。。。
- 思路2:验证was版本,换版本试试
was版本换到7.0.0.11,测试,竟然成功了!!!
这让情何以堪啊,难道让客户去换was?唉。。。
- 思路3:降低Hibernate版本
- 在国外网站上发现了这个帖子
http://forum.spring.io/forum/spring-projects/data/115503-websphere-7-spring-3-1-hibernate-4
多么相似的问题,马上看解决办法The 'only' resolution was to downgrade the Hibernate to version 3. It more or less worked straight away then.好吧,没办法了,把hibernate4.1.2降低到hibernate3.2,测试。。。结果依旧,这下有点郁闷到了。
不甘心啊,这个太折腾人了,不出个结果怎么行呢,于是继续换版本,把hibernate换到 3.6版本。测试之。。。终于,ok了。
hibernate3.6下spring配置贴出来: -
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 4 xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" 5 xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" 6 xsi:schemaLocation=" 7 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 8 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 9 http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd 10 http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd 11 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd 12 http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" 13 default-autowire="byName" default-lazy-init="true"> 14 15 <!-- 数据源配置, 使用proxool数据库连接池 --> 16 <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> 17 <property name="driver" value="${jdbc.driverClassName}" /> 18 <property name="driverUrl" value="${jdbc.url}" /> 19 <property name="user" value="${jdbc.username}" /> 20 <property name="password" value="${jdbc.password}" /> 21 <property name="alias" value="${jdbc.alias}" /> 22 <property name="maximumActiveTime" value="1800000" /> 23 <property name="prototypeCount" value="1" /> 24 <property name="maximumConnectionCount" value="200" /> 25 <property name="minimumConnectionCount" value="1" /> 26 <property name="houseKeepingTestSql" value="${dataSource.houseKeepingTestSql}"/> 27 <property name="trace" value="false" /> 28 </bean> 29 30 <!-- Hibernate SessionFactory --> 31 <bean id="sessionFactory" 32 class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 33 <property name="dataSource" ref="dataSource" /> 34 <property name="hibernateProperties"> 35 <props> 36 <prop key="hibernate.dialect">${hibernate.dialect}</prop> 37 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> 38 <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> 39 <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop> 40 <prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop> 41 <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop> 42 <prop key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop> 43 <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> 44 <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop> 45 <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop> 46 </props> 47 </property> 48 <property name="mappingDirectoryLocations"> 49 <list> 50 <value>classpath*:com/entity</value> 51 </list> 52 </property> 53 </bean> 54 55 56 <!-- Transaction manager for a single Hibernate SessionFactory (alternative 57 to JTA) --> 58 <bean id="transactionManager" 59 class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 60 <property name="sessionFactory" ref="sessionFactory" /> 61 </bean> 62 63 <!-- 定义事务管理器(声明式的事务) --> 64 <bean id="transactionInterceptor" 65 class="org.springframework.transaction.interceptor.TransactionInterceptor"> 66 <property name="transactionManager" ref="transactionManager" /> 67 <!-- 配置事务属性 --> 68 <property name="transactionAttributes"> 69 <props> 70 <prop key="add*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 71 </prop> 72 <prop key="recovery*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 73 </prop> 74 <prop key="alter*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 75 </prop> 76 <prop key="edit*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 77 </prop> 78 <prop key="batch*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 79 </prop> 80 <prop key="change*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 81 </prop> 82 <prop key="compare*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 83 </prop> 84 <prop key="create*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 85 </prop> 86 <prop key="delete*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 87 </prop> 88 <prop key="del*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 89 </prop> 90 <prop key="execute*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 91 </prop> 92 <prop key="export*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 93 </prop> 94 <prop key="gen*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 95 </prop> 96 <prop key="import*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 97 </prop> 98 <prop key="insert*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 99 </prop> 100 <prop key="promulgate*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 101 </prop> 102 <prop key="publish*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 103 </prop> 104 <prop key="release*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 105 </prop> 106 <prop key="reset*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 107 </prop> 108 <prop key="save*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 109 </prop> 110 <prop key="execute*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 111 </prop> 112 <prop key="modify*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 113 </prop> 114 <prop key="activate*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 115 </prop> 116 <prop key="grant*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 117 </prop> 118 <prop key="ungrant*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 119 </prop> 120 <prop key="syn*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 121 </prop> 122 <prop key="update*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 123 </prop> 124 <prop key="version*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 125 </prop> 126 <prop key="disEnable*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 127 </prop> 128 <prop key="enable*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 129 </prop> 130 <prop key="write*">PROPAGATION_REQUIRED,-RollbackableBizException,-BizException 131 </prop> 132 <prop key="check*">PROPAGATION_REQUIRED,readOnly</prop> 133 <prop key="count*">PROPAGATION_REQUIRED,readOnly</prop> 134 <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> 135 <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> 136 <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> 137 <prop key="output*">PROPAGATION_REQUIRED,readOnly</prop> 138 <prop key="parse*">PROPAGATION_REQUIRED,readOnly</prop> 139 <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> 140 <prop key="show*">PROPAGATION_REQUIRED,readOnly</prop> 141 </props> 142 </property> 143 </bean> 144 145 <!-- 注册自动代理创建,为业务Bean添加事务拦截器 --> 146 <bean 147 class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> 148 <property name="beanNames"> 149 <list> 150 <value>*Service</value> 151 </list> 152 </property> 153 <property name="interceptorNames"> 154 <list> 155 <!-- 事务控制 --> 156 <value>transactionInterceptor</value> 157 </list> 158 </property> 159 </bean> 160 161 </beans>
呵呵,其实也没有改什么内容,注意一下jar包就可以了
至此,问题总算是有了个解决,至于原因,后面有时间再研究了。。。
相关推荐
### Hibernate4.1环境搭建详解 #### 一、概述 在构建现代Web应用程序时,集成Spring框架、Struts2以及Hibernate等技术是非常常见的选择。这些技术的组合通常被称为SSH(Spring + Struts + Hibernate),是一种非常...
Java SpringMVC 4.0 和 Hibernate 4.1 是两个非常重要的开源框架,它们在企业级Java应用程序开发中占据着核心地位。SpringMVC是Spring框架的一部分,专门用于构建Web应用程序,而Hibernate则是一个对象关系映射(ORM...
《Wicket6.0_Spring3.1_Hibernate4.1_EJB全注解实例》是一个集成开发案例,它结合了四个重要的Java技术框架:Wicket、Spring、Hibernate和EJB,同时使用JTA(Java Transaction API)进行事务管理。这个实例在...
**标题:“Hibernate4.1”** **描述:**该压缩包包含了关于Hibernate 4.1版本的相关资源,包括帮助文档、源代码以及必要的jar包。Hibernate是一个强大的对象关系映射(ORM)框架,它简化了Java应用程序与数据库之间...
在"spring3.1+hibernate4.1+struts2整合jar包"中,包含了这三个框架的最新稳定版本,确保了良好的兼容性和性能。Spring 3.1引入了更多改进,如支持JSR-330标准的依赖注入,增强了对Groovy的支持,以及对AOP的进一步...
标题中的"Spring3.1.1+struts2.3.4+hibernate4.1 jar包"指的是一个整合了三个主流Java企业级开发框架的库文件集合,分别是Spring 3.1.1、Struts 2.3.4和Hibernate 4.1。这些jar包通常用于构建基于Java的Web应用程序...
在开始使用Hibernate 4.1之前,需要将其依赖库添加到项目的类路径中。通常,这可以通过Maven或Gradle等构建工具完成。配置文件`hibernate.cfg.xml`用于设置数据库连接信息,包括URL、用户名、密码、驱动类等。 三、...
在Java应用开发中,尤其是在企业级应用开发领域,Hibernate被广泛使用,因为它极大地提高了开发效率并降低了数据库操作的复杂性。 在Hibernate 4.1版本中,引入了许多新特性和改进,以提高性能和易用性。首先,它...
SessionFactory在应用程序启动时初始化一次,然后在整个应用生命周期中重用。 3. **Session**:Session是与数据库交互的主要接口,它实现了对持久化对象的操作,如保存、更新、删除和查询。Session还提供了事务管理...
本指南将详细介绍如何在项目中集成Spring 3.2和Hibernate 4.1,构建一个基于MVC模式的应用程序。 Spring 3.2是Spring框架的一个重要版本,它在原有的基础上增强了依赖注入(DI)和面向切面编程(AOP)的功能。在...
这个"spring3.1 struts2.3 hibernate4.1 jpa集成小例子"是一个典型的Java Web项目,它展示了如何将Spring 3.1、Struts 2.3、Hibernate 4.1和Java Persistence API (JPA) 这四大组件融合到一个应用中。接下来,我们将...
Struts2.3 + Spring3.2 + Hibernate4.1 + HTML5 + CSS3开发示例代码。 其中包括如下文件: 介绍文档 Struts2.3 + Spring3.2 + Hibernate4.1 + HTML5 + CSS3开发示例.docx Eclipse工程文件 SSH2.zip Zip包是Eclipse...
Hibernate4.1在性能和功能上都有所提升,包括支持JPA 2.1规范、优化的缓存机制以及对新数据库特性的支持。 在这个SSH整合中,Struts2负责处理HTTP请求和响应,Spring管理整个应用的bean,包括Struts2的Action和...
《基于J2EE的Wicket6.0+Hibernate4.1+Spring3.1实例程序详解》 在当今的Web开发领域,Java EE(J2EE)框架的使用广泛而深入,尤其在企业级应用中占据重要地位。本文将详细探讨一个基于J2EE的实例程序,它整合了...
这个实例项目在Glassfish 3.1.2应用服务器上运行,并与PostgreSQL 9数据库进行了无缝对接。下面将详细介绍这些关键技术及其在项目中的应用。 1. **DWR(Direct Web Remoting)3.0**:DWR是一种JavaScript库,它允许...
在Glassfish应用服务器上,JTA能够协调不同资源(如数据库)的事务行为。 6. Glassfish 3.1.2:这是一个开源的Java EE应用服务器,支持各种Java EE规范,包括JTA。在这个实例中,Glassfish作为运行环境,承载了Web...
### hibernate4.1中文API知识点汇总 #### 1. 教程 ##### 1.1 第一部分 - 第一个Hibernate应用程序 - **设置**: 安装必要的开发环境,包括Java SDK、IDE(如Eclipse或IntelliJ IDEA)、Hibernate库等。 - **第一节...
标题中的“Spring3.1+Hibernate4.1+Atomikos3.9+MySql5.1+Tomcat5/6/7实现JTA事务管理”揭示了一个集成开发环境,用于构建分布式、事务一致性的Java应用程序。这个组合利用了Spring框架的依赖注入和AOP(面向切面...
标题 "Wicket6.0_Spring3.1_Hibernate4.1_JPA全注解实例" 描述了一个基于Java技术栈的Web应用开发项目,它整合了四个关键的技术:Wicket 6.0、Spring 3.1、Hibernate 4.1以及JPA。这个项目采用了全注解的方式,使得...
spring4.1+struts2.3+hibernate4.1整合案例,实现了增删改查等功能。spring4.1+struts2.3+hibernate4.1整合案例,实现了增删改查等功能。spring4.1+struts2.3+hibernate4.1整合案例,实现了增删改查等功能。spring...