休眠异常:找到预绑定的 JDBC 连接

2022-09-04 04:46:40

我有以下问题:

在多用户弹簧休眠 Web 应用程序中,我们遇到以下异常。检查日志记录时,它会在多个位置发生。我用谷歌搜索了一下,还检查了Stackoverflow,但我找不到解决方案:

找到预绑定的 JDBC 连接!HibernateTransactionManager 不支持在 DataSourceTransactionManager 中运行(如果被告知要管理 DataSource 本身)。建议对单个数据源上的所有事务使用单个 HibernateTransactionManager,无论 Hibernate 还是 JDBC 访问。

我读到这可能是一个配置问题,但我没有看到有什么问题,所以我将包括休眠配置:

<!-- pooled datasource -->
<bean id="dataSource" class="org.apache.commons.dbcp.PoolingDataSource" depends-on="poolableConnectionFactory">
    <constructor-arg>
        <ref bean="pool"/>
    </constructor-arg>
</bean>

<bean id="ds" class="com.ibm.db2.jcc.DB2SimpleDataSource">
    <property name="serverName">
        <value>xxx.xxx.xxx.xxx</value>
    </property>
    <property name="databaseName">
        <value>xxx</value>
    </property>
    <property name="portNumber">
        <value>50000</value>
    </property>
    <property name="user">
        <value>xxx</value>
    </property>
    <property name="password">
        <value>xxx</value>
    </property>
    <property name="driverType">
        <value>4</value>
    </property>
    <property name="allowNextOnExhaustedResultSet">
        <value>1</value>
    </property>
    <property name="deferPrepares">
        <value>false</value>
    </property>
</bean>

<bean id="pool" class="org.apache.commons.pool.impl.GenericObjectPool">
    <property name="minIdle">
        <value>5</value>
    </property>
    <property name="maxActive">
        <value>50</value>
    </property>
    <property name="minEvictableIdleTimeMillis">
        <value>90000</value>
    </property>
    <property name="timeBetweenEvictionRunsMillis">
        <value>30000</value>
    </property>
</bean>

<bean id="dsConnectionFactory" class="org.apache.commons.dbcp.DataSourceConnectionFactory">
    <constructor-arg index="0">
        <ref bean="ds"/>
    </constructor-arg>
</bean>

<bean id="poolableConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory">
    <constructor-arg index="0"><ref bean="dsConnectionFactory"/></constructor-arg>
    <constructor-arg index="1"><ref bean="pool"/></constructor-arg>
    <constructor-arg index="2"><null/></constructor-arg>
    <constructor-arg index="3"><value>SELECT 1 FROM SYSIBM.SYSDUMMY1</value></constructor-arg>
    <constructor-arg index="4"><value>false</value></constructor-arg>
    <constructor-arg index="5"><value>true</value></constructor-arg>
</bean>

<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="mappingLocations">
        <list>
            <value>classpath:aaa/bbb/Ccc.hbm.xml</value>
            <value>classpath:aaa/bbb/Cdd.hbm.xml</value>
            <value>classpath:aaa/bbb/Eee.hbm.xml</value>                
        </list>
    </property>
    <property name="annotatedClasses">
        <list>
           <value>aaa.bbb.Fff</value>
           <value>aaa.bbb.Ggg</value>   
           <value>aaa.bbb.Hhh</value>
        </list>
   </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">be.camco.po.persistency.hibernate.dialect.MyCustomDialect</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.default_batch_fetch_size">20</prop>
            <prop key="hibernate.show_sql">false</prop>
        </props>
    </property>
    <property name="dataSource">
        <ref bean="dataSource"/>
    </property>
</bean>

<!-- open session in view -->
<bean name="openSessionInViewInterceptor" class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
    <property name="sessionFactory">
        <ref bean="hibernateSessionFactory"/>
    </property>
    <!-- flush auto =1, 0 = never-->
    <property name="flushMode">
        <value>1</value>
    </property>
</bean>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
        <ref local="hibernateSessionFactory"/>
    </property>
</bean>

对于那些想知道正在使用什么冬眠verion的人;在部署时,日志中将显示以下内容:

[版本]休眠注释 3.2.1.GA

INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA

弹簧 3.2.4 正在使用,弹簧安全 3.1.4

下面是一个堆栈跟踪。例外情况确实在多个场合发生;我无法重现异常;它似乎只是在某个时候发生。在堆栈跟踪中,我包含了异常之前的日志记录,其中包含“预绑定 JDBC 连接...”,但我不知道它们是否相关:

> 2015-07-23 14:53:45,734 ERROR [org.springframework.transaction.support.TransactionSynchronizationUtils] TransactionSynchronization.afterCompletion threw exception
java.util.ConcurrentModificationException
    at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(Unknown Source)
    at java.util.LinkedHashMap$ValueIterator.next(Unknown Source)
    at org.hibernate.engine.StatefulPersistenceContext.afterTransactionCompletion(StatefulPersistenceContext.java:253)
    at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:450)
    at org.springframework.orm.hibernate3.SpringSessionSynchronization.afterCompletion(SpringSessionSynchronization.java:199)
    ...
2015-07-23 14:53:45,736 ERROR [STDERR] org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate3.SessionHolder@4acab4eb] for key [org.hibernate.impl.SessionFactoryImpl@6c164690] bound to thread [http-10.249.0.32-443-4]
2015-07-23 14:53:45,736 ERROR [STDERR]  at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:541)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
2015-07-23 14:53:45,737 ERROR [STDERR]  at be.camco.po.BusinessFacade$$EnhancerByCGLIB$$100126ee.toJSON(<generated>)
2015-07-23 14:53:45,737 ERROR [STDERR]  at be.camco.po.web.controller.ShipmentController.toListView(ShipmentController.java:200)
2015-07-23 14:53:45,737 ERROR [STDERR]  at sun.reflect.GeneratedMethodAccessor829.invoke(Unknown Source)
2015-07-23 14:53:45,737 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2015-07-23 14:53:45,737 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Unknown Source)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
2015-07-23 14:53:45,737 ERROR [STDERR]  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
2015-07-23 14:53:45,738 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
2015-07-23 14:53:45,738 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:53:45,738 ERROR [STDERR]  at be.camco.po.web.filter.MenuFilter.doFilter(MenuFilter.java:28)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:53:45,738 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
2015-07-23 14:53:45,739 ERROR [STDERR]  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
2015-07-23 14:53:45,739 ERROR [STDERR]  at java.lang.Thread.run(Unknown Source)
2015-07-23 14:53:45,740 ERROR [STDERR] Caused by: java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate3.SessionHolder@4acab4eb] for key [org.hibernate.impl.SessionFactoryImpl@6c164690] bound to thread [http-10.249.0.32-443-4]
2015-07-23 14:53:45,740 ERROR [STDERR]  at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:189)
2015-07-23 14:53:45,740 ERROR [STDERR]  at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:532)
2015-07-23 14:53:45,740 ERROR [STDERR]  ... 65 more
2015-07-23 14:56:20,645 ERROR [STDERR] org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
2015-07-23 14:56:20,646 ERROR [STDERR]  at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:427)
2015-07-23 14:56:20,646 ERROR [STDERR]  at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
2015-07-23 14:56:20,646 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
2015-07-23 14:56:20,646 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
2015-07-23 14:56:20,647 ERROR [STDERR]  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
2015-07-23 14:56:20,647 ERROR [STDERR]  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
2015-07-23 14:56:20,647 ERROR [STDERR]  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
2015-07-23 14:56:20,647 ERROR [STDERR]  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
2015-07-23 14:56:20,647 ERROR [STDERR]  at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
2015-07-23 14:56:20,648 ERROR [STDERR]  at be.camco.po.BusinessFacade$$EnhancerByCGLIB$$100126ee.findProductByCode(<generated>)
2015-07-23 14:56:20,648 ERROR [STDERR]  at be.camco.po.web.controller.ProductController.formBackingObject(ProductController.java:616)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.mvc.AbstractFormController.getErrorsForNewForm(AbstractFormController.java:361)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:341)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:281)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
2015-07-23 14:56:20,648 ERROR [STDERR]  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
2015-07-23 14:56:20,649 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
2015-07-23 14:56:20,649 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:56:20,649 ERROR [STDERR]  at be.camco.po.web.filter.MenuFilter.doFilter(MenuFilter.java:28)
2015-07-23 14:56:20,649 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
2015-07-23 14:56:20,650 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2015-07-23 14:56:20,651 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2015-07-23 14:56:20,652 ERROR [STDERR]  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
2015-07-23 14:56:20,653 ERROR [STDERR]  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
2015-07-23 14:56:20,653 ERROR [STDERR]  at java.lang.Thread.run(Unknown Source)

答案 1

我认为您的代码不完整,无法唯一地解决您的问题:和 之间没有隐含的关系,不匹配spring版本3.2.4的行号(例如。 在 532 行没有呼叫等)。poolpoolableConnectionFactoryHibernateTransactionManager.javaTransactionSynchronizationManager.bindResource()

我没有在您的配置中找到声明。并且您在方法中使用注释驱动的事务。<tx:annotation-driven/>ProductController.formBackingObject()

所以我的猜测是你的情况在这里描述

编辑:在春季版本2.0.8中呼叫532行。正如您在注释中指出的那样,应用程序类路径包含 ,但应改用。HibernateTransactionManagerbindResource()spring-hibernate3-2.0.8.jarspring-orm-3.2.4.jar


答案 2

推荐