java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager

Stack Overflow | sandeepp | 8 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    How to use cross context in spring mvc?

    Stack Overflow | 8 months ago | sandeepp
    java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
  2. 0

    Trying to use a plugin that uses spring-mvc might cause the following exception: {code:java} [INFO] [talledLocalContainer] java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager [INFO] [talledLocalContainer]   at org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager(WebAsyncUtils.java:46) [INFO] [talledLocalContainer]   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:960) [INFO] [talledLocalContainer]   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) {code} This is due to spring-mvc setting a request attribute with the WebAsyncManager in core (using Spring3), and spring request processing in the plugin trying to reuse it and cast it to the Spring4 version, which fails. A workaround is to declare a servlet-filter module in the plugin that will handle cleaning the request attribute before further processing: {code:java} @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request.getAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE) != null) { request.setAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE, null); } {code}

    Atlassian JIRA | 7 months ago | Lukasz Pater
    java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager

      at org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager()
    2. Spring
      WebAsyncUtils.getAsyncManager
      1. org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager(WebAsyncUtils.java:44)
      1 frame
    3. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:916)
      2. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
      2 frames
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
      1 frame
    5. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
      1 frame