这个问题在我们的生产服务器上时不时地发生在并发请求负载相当大的时刻(这样想,但不确定)。不幸的是,我们无法重现它以进行调试……正如您所看到的,我们OpenSessionInViewFilter
在过滤器链中使用了它。DAO,没有注释。
我在 SpringSource Jira 问题https://jira.springsource.org/browse/SPR-3693上阅读了有关此效果的信息,但由于我们使用 Spring 版本3.1.2.RELEASE,这似乎是一个远离修复的错误。
我将不胜感激如何重现此案例或修复它的任何想法。
事务定义没有什么特别的(但错误落在了getTransaction
):
DefaultTransactionDefinition td = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED);
td.setIsolationLevel(TransactionDefinition.ISOLATION_DEFAULT);
TransactionStatus status = transactionManager.getTransaction(td);
错误堆栈原因:
java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@1ff8c2a] bound to thread ["http-apr-83"-exec-3]
at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209)
at org.springframework.orm.hibernate3.SpringSessionSynchronization.suspend(SpringSessionSynchronization.java:115)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.doSuspendSynchronization(AbstractPlatformTransactionManager.java:666)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.suspend(AbstractPlatformTransactionManager.java:569)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:363)
at com.havilog.baltic.cheetah.services.RtMovementsServiceImpl.moveDone(RtMovementsServiceImpl.java:867)
at sun.reflect.GeneratedMethodAccessor798.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
at org.apache.wicket.proxy.$Proxy8.moveDone(Unknown Source)
at com.havilog.baltic.cheetah.rf.visual.pages.movements.refill.EnterQuantity.setLocationQty(EnterQuantity.java:378)
at sun.reflect.GeneratedMethodAccessor820.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1185)
at org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:641)
at org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:143)
at org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:186)
at org.apache.wicket.Component.setDefaultModelObject(Component.java:3068)
at org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1498)
at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1059)
at org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:221)
at org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:192)
at org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:273)
at org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:261)
at org.apache.wicket.util.visit.Visits.visitPostOrder(Visits.java:244)
at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:388)
at org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:1763)
at org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:1728)
at org.apache.wicket.markup.html.form.Form.process(Form.java:900)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:757)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:692)
at sun.reflect.GeneratedMethodAccessor374.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1714)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)