spring blazeds 集成:IllegalArgumentException:ServletContext 不能为 null

发布于 2024-10-31 20:28:37 字数 11499 浏览 0 评论 0原文

我正在尝试使用 BlazeDS 4.0.0.14931、Spring 3.0.5 和 Spring-BlazeDS-Integration 1.5.0.M2 在 Apache Tomcat 7.0.12 上运行 dpHibernate 2.0 RC6

我的配置已经很不错了,服务解析得很好、基于注释的实体和数据模型都很好,我可以在 FlashBuilder DCD 中列出服务,但是一旦我调用服务方法(只是一个简单的 void 方法),服务器就会返回以下异常。不太确定在我的配置中我可能错过了一些东西,正如我从文档中了解到的那样,其余部分是自动连接的。

{operation})****************getAll
{invoke} 6823
java.lang.IllegalArgumentException: ServletContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:109)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:99)
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:82)
at org.dphibernate.serialization.SpringContextSerializerFactory.getContextReference(SpringContextSerializerFactory.java:111)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializerContextReference(SpringContextSerializerFactory.java:65)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:56)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:51)
at org.dphibernate.adapters.RemotingAdapter.invoke(RemotingAdapter.java:132)
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:572)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$5dafba90.serviceMessage(<generated>)
at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$5dafba90.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
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:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
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)
[BlazeDS]Exception when invoking service 'remoting-service': flex.messaging.MessageException: ServletContext must not be null
incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage) 
operation = getAll
clientId = E8B0A041-2F0D-95A8-1F38-D5D244CDA6E4
destination = personService
messageId = 499B6C51-8E26-DD96-9055-79EF0D3823B0
timestamp = 1303420800415
timeToLive = 0
body = 
[

]
hdr(DSId) = E8B03010-7B0F-DED7-6D71-C4623D635D2A
hdr(DSEndpoint) = amf
Exception: flex.messaging.MessageException: ServletContext must not be null
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:225)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:572)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$5dafba90.serviceMessage(<generated>)
at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$5dafba90.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
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:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
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)
Caused by: java.lang.RuntimeException: ServletContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:109)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:99)
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:82)
at org.dphibernate.serialization.SpringContextSerializerFactory.getContextReference(SpringContextSerializerFactory.java:111)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializerContextReference(SpringContextSerializerFactory.java:65)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:56)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:51)
at org.dphibernate.adapters.RemotingAdapter.invoke(RemotingAdapter.java:132)
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
... 45 more

I am trying to get dpHibernate 2.0 RC6 running on an Apache Tomcat 7.0.12 with BlazeDS 4.0.0.14931, Spring 3.0.5 and Spring-BlazeDS-Integration 1.5.0.M2

I got pretty far with my configuration, the services are parsed fine, annotation based Entities and Datamodel are good, I can list the services in FlashBuilder DCD, but as soon as I am calling a service method (just a simple void method) the server returns following Exception. Not really sure where in my configuration I could have missed something, as I understood from the docs the rest is auto wired.

{operation})****************getAll
{invoke} 6823
java.lang.IllegalArgumentException: ServletContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:109)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:99)
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:82)
at org.dphibernate.serialization.SpringContextSerializerFactory.getContextReference(SpringContextSerializerFactory.java:111)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializerContextReference(SpringContextSerializerFactory.java:65)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:56)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:51)
at org.dphibernate.adapters.RemotingAdapter.invoke(RemotingAdapter.java:132)
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
at flex.messaging.endpoints.AbstractEndpoint$FastClassByCGLIB$1a3ef066.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:572)
at flex.messaging.endpoints.AMFEndpoint$EnhancerByCGLIB$5dafba90.serviceMessage(<generated>)
at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$EnhancerByCGLIB$5dafba90.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
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:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
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)
[BlazeDS]Exception when invoking service 'remoting-service': flex.messaging.MessageException: ServletContext must not be null
incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage) 
operation = getAll
clientId = E8B0A041-2F0D-95A8-1F38-D5D244CDA6E4
destination = personService
messageId = 499B6C51-8E26-DD96-9055-79EF0D3823B0
timestamp = 1303420800415
timeToLive = 0
body = 
[

]
hdr(DSId) = E8B03010-7B0F-DED7-6D71-C4623D635D2A
hdr(DSEndpoint) = amf
Exception: flex.messaging.MessageException: ServletContext must not be null
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:225)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
at flex.messaging.endpoints.AbstractEndpoint$FastClassByCGLIB$1a3ef066.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:572)
at flex.messaging.endpoints.AMFEndpoint$EnhancerByCGLIB$5dafba90.serviceMessage(<generated>)
at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$EnhancerByCGLIB$5dafba90.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
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:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
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)
Caused by: java.lang.RuntimeException: ServletContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:109)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:99)
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:82)
at org.dphibernate.serialization.SpringContextSerializerFactory.getContextReference(SpringContextSerializerFactory.java:111)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializerContextReference(SpringContextSerializerFactory.java:65)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:56)
at org.dphibernate.serialization.SpringContextSerializerFactory.getSerializer(SpringContextSerializerFactory.java:51)
at org.dphibernate.adapters.RemotingAdapter.invoke(RemotingAdapter.java:132)
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
... 45 more

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟雨凡馨 2024-11-07 20:28:38

这与其说是 dpHibernate 问题,不如说是 Spring/Web.xml 配置的问题。因此,请认为这是最好的猜测,因为周围还有其他人比我知道得多。

看来您缺少 部分code>web.xml:

<context-param>
       <param-name>contextConfigLocation</param-name>
        <param-value>
               /WEB-INF/applicationContext.xml
        </param-value>
</context-param>

该片段取自 dpHibernate 站点上的示例之一

您看到的错误是由缺少 SpringContext 引起的,dpHibernate 需要该 SpringContext 才能查找您的 Hibernate 会话。

This isn't so much a dpHibernate issue, as it is an issue with your Spring/Web.xml config. As such, please consider this a best guess, as there are others around who know a helluva lot more than I.

It appears you're missing the <context-param /> section from your web.xml:

<context-param>
       <param-name>contextConfigLocation</param-name>
        <param-value>
               /WEB-INF/applicationContext.xml
        </param-value>
</context-param>

That snippet is taken from one of the samples on the dpHibernate site

The error you're seeing is caused by a missing SpringContext which is needed by dpHibernate in order to look up your Hibernate session.

葬シ愛 2024-11-07 20:28:38

抱歉,需要重新打开...

我的应用程序配置主要类似于lazyOverflow 示例。但是当我调用自己的服务来填充 ArrayCollection PM 时,我不断收到此 ServletContext 错误。示例是通过 LoadRecentQuestionsCommand 从RecentQuestionPM 调用getRecentQuestions() 以及RecentQuestionPM 中的相应结果处理程序。

http:// /code.google.com/p/lazyoverflow/source/browse/trunk/flex/src/com/mangofactory/pepper/view/RecentQuestionsPM.as

服务器配置现在与示例中完全相同,只是我自己的实体、DAO 和服务名称。

据我所知,这就是问题所在:

SpringContextSerializerFactory:111
ServletContext servletContext = FlexContext.getServletContext();
--> servletContext --> null

Sorry, need to reopen ...

I configured my application mostly like the lazyOverflow sample. But when I call my own service to populate my ArrayCollection PM I keep getting this ServletContext Error. Sample is the call to getRecentQuestions() from RecentQuestionPM via LoadRecentQuestionsCommand and the according result handler in RecentQuestionPM.

http://code.google.com/p/lazyoverflow/source/browse/trunk/flex/src/com/mangofactory/pepper/view/RecentQuestionsPM.as

Server Configuration is now exactly the same as in the sample, just with my own Entity, DAO and Service names.

Thats as far as I could track the problem:

SpringContextSerializerFactory:111
ServletContext servletContext = FlexContext.getServletContext();
--> servletContext --> null
旧城空念 2024-11-07 20:28:38

感谢您的帮助,最后我可以将范围缩小到 FlexContext.getServletContext();在 SpringContextSerializerFactory.java 第 110 行返回“null”(dpHibernate 当前“2.0”分支,springExtensions 3.0)。

对此的快速修复(与当前实现保持兼容)是将代码更改为如下所示:

    ServletContext servletContext = FlexContext.getServletContext();
    if(servletContext == null) // fix for Servlet Context must not be null exception during migration to Spring 3.0
        servletContext = FlexContext.getMessageBroker().getServletContext();
    context= WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

不知道我是否在这里做了一些丑陋的事情,但对我有用。只是想...这一行尝试通过当前的 servletContext 获取 Web 应用程序根上下文,如果这是 null,则只需通过另一个如果此请求到达这里就必须存在的上下文(即 springMessageBrokerServlet)来获取它。

Thanks for the help, finally I could narrow it down to FlexContext.getServletContext(); returning "null" in SpringContextSerializerFactory.java line 110 (dpHibernate current "2.0" branch, springExtensions 3.0).

Quick fix to this (staying compatible to the current implementation) was altering the code to look like the following:

    ServletContext servletContext = FlexContext.getServletContext();
    if(servletContext == null) // fix for Servlet Context must not be null exception during migration to Spring 3.0
        servletContext = FlexContext.getMessageBroker().getServletContext();
    context= WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

Don't know if I am doing something ugly here, but works for me. Just thinking ... this line attempts to get the webapplication root context via the current servletContext, if this is null just get it via another one that must be there if this request gets here (which is the springMessageBrokerServlet).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文