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

Atlassian JIRA | Lukasz Pater | 4 months ago
  1. 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 | 4 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
  2. 0

    How to use cross context in spring mvc?

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

    Memcached Java客户端2.6.1发布 - 编程语言 - ITeye资讯

    iteye.com | 1 year ago
    java.lang.ClassCastException: cannot be cast to
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    cannot be cast to javax.servlet.Filter | Oracle Community

    oracle.com | 8 months ago
    java.lang.ClassCastException: cannot be cast to javax.servlet.Filter
  6. 0

    How to authenticate Azure Mobile Services in Android Service

    Stack Overflow | 2 years ago | Neil
    java.lang.ClassCastException: *** cannot be cast to android.app.Activity

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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:46)
      1 frame
    3. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:960)
      2. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
      2 frames