java.lang.ClassCastException: org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes

Spring JIRA | Vikram Hullukunte | 3 years ago
  1. 0

    In jersey-spring3, The org.glassfish.jersey.server.spring.scope.RequestContextFilter class creates JaxrsRequestAttributes datastructure and sets in the Threadlocal. If an exception occurs in the calling chain of the jersey resource and the exception is not handled by jersey, then Spring's RequestContextListner bombs while destroying the threadlocal set as part of the request. The exception: SEVERE: Exception sending request initialized lifecycle event to listener instance of class org.springframework.web.context.request.RequestContextListener java.lang.ClassCastException: org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes at org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:70) at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6080) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

    Spring JIRA | 3 years ago | Vikram Hullukunte
    java.lang.ClassCastException: org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes
  2. 0

    In jersey-spring3, The org.glassfish.jersey.server.spring.scope.RequestContextFilter class creates JaxrsRequestAttributes datastructure and sets in the Threadlocal. If an exception occurs in the calling chain of the jersey resource and the exception is not handled by jersey, then Spring's RequestContextListner bombs while destroying the threadlocal set as part of the request. The exception: SEVERE: Exception sending request initialized lifecycle event to listener instance of class org.springframework.web.context.request.RequestContextListener java.lang.ClassCastException: org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes at org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:70) at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6080) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

    Spring JIRA | 3 years ago | Vikram Hullukunte
    java.lang.ClassCastException: org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes
  3. 0

    the correct order of filters in web.xml for a grails application

    Stack Overflow | 5 years ago | pri_dev
    java.lang.ClassCastException: org.springframework.web.context.request.ServletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Grails 1.3.3 filters - either a NullPointerException or a ClassCastException

    Stack Overflow | 6 years ago | Bozho
    java.lang.ClassCastException: org.springframework.web.context.request.ServletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
  6. 0

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

    iteye.com | 1 year ago
    java.lang.ClassCastException: cannot be cast to

    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.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes cannot be cast to org.springframework.web.context.request.ServletRequestAttributes

      at org.springframework.web.context.request.RequestContextListener.requestDestroyed()
    2. Spring
      RequestContextListener.requestDestroyed
      1. org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:70)
      1 frame
    3. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6080)
      2. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
      3. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      4. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
      5. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      6. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      6 frames
    4. Grizzly HTTP
      NioEndpoint$SocketProcessor.run
      1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
      2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      3. org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
      3 frames
    5. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      3. java.lang.Thread.run(Thread.java:724)
      3 frames