问题描述
我想在Spring应用程序中使用交叉上下文功能,因此我可以将一些webapp1 JSP导入到webapp2 JSP中。我正在使用包含Tomcat 7.0.42(vFabric TC Server)和Spring Framework 3.2.8的Eclipse STS。
I want to use the cross context feature in a Spring application so I can import some webapp1 JSP into a webapp2 JSP. I'm using Eclipse STS with the included Tomcat 7.0.42 (vFabric TC Server) and Spring Framework 3.2.8.
我已经配置了Tomcat conf / context.xml拥有:`
I have configured the Tomcat conf/context.xml to have: `
<Context crossContext="true">...</Context>`.
在webapp2 JSP中我使用`
In the webapp2 JSP I use `
<c:import context="/webapp1" url="/myurl" />`.
当我调用webapp2 JSP时出现此错误:
When I call the webapp2 JSP I have this error:
HTTP Status 500 - javax.servlet.ServletException: javax.servlet.jsp.JspException: `java.lang.ClassCastException:` `org.springframework.web.context.request.async.WebAsyncManager cannot be cast to` org.springframework.web.context.request.async.WebAsyncManager`
有没有其他人遇到过这个?
Has anyone else encountered this?
推荐答案
看起来像Spring还没有为交叉上下文请求处理做好准备(至少没有一点点黑客攻击)。
Seems like Spring is not ready for cross context request processing (at least not without a bit of hacking).
FrameworkServlet
。并且(类加载器)。
我看到两种可能性如何解决这个问题:
I see two possibilities how to workaround this:
- 实现你自己的
include
JSP标记,它将包装原始请求,以便Spring特定属性不可见(通常以org.springframework
开头)到第二个上下文。 - Put共享类加载器路径中的Spring JAR(这可能是更简单的方法)。
- Implement your own
include
JSP tag, which will wrap the original request so that Spring specific attributes are not visible (usually the ones starting withorg.springframework
) to the second context. - Put Spring JARs in a shared class loader path (that would be probably the easier way).
这篇关于Spring和交叉上下文:WebAsyncManager无法转换为WebAsyncManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!