java.lang.IllegalStateException:绑定到线程的键没有值

时间:2012-09-05 13:41:20

标签: spring hibernate transactions database-connection

在相当繁重的并发请求加载时,我们的生产服务器上会不时出现此问题(请注意,但不确定)。不幸的是,我们无法重现它进行调试...... 如您所见,我们在过滤器链中使用OpenSessionInViewFilter。 DAOs,没有注释。

我在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)

0 个答案:

没有答案