gpt4 book ai didi

java - spring 和跨上下文 : WebAsyncManager cannot be cast to WebAsyncManager

转载 作者:搜寻专家 更新时间:2023-11-01 02:45:55 25 4
gpt4 key购买 nike

我想在 Spring 应用程序中使用跨上下文功能,这样我就可以将一些 webapp1 JSP 导入到 webapp2 JSP 中。我将 Eclipse STS 与随附的 Tomcat 7.0.42(vFabric TC 服务器)和 Spring Framework 3.2.8 一起使用。

我已将 Tomcat conf/context.xml 配置为:`

<Context crossContext="true">...</Context>`. 

在 webapp2 JSP 中我使用 `

<c:import context="/webapp1" url="/myurl" />`.

当我调用 webapp2 JSP 时出现此错误:

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`

有没有人遇到过这个?

最佳答案

似乎 Spring 还没有准备好进行跨上下文请求处理(至少不是没有一点黑客)。

FrameworkServlet always tries to get WebAsyncManager来自请求属性。和 way it is extracted can not work across different contexts (类加载器)。

我看到了两种解决方法:

  • 实现您自己的 include JSP 标记,它将包装原始请求,以便 Spring 特定属性(通常以 org.springframework 开头的属性)对第二个上下文。
  • 将 Spring JAR 放在共享的类加载器路径中(这可能是更简单的方法)。

关于java - spring 和跨上下文 : WebAsyncManager cannot be cast to WebAsyncManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22128150/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com