java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor

Spring JIRA | Roger Villars | 8 years ago
  1. 0

    I tried to reconfigure Spring-DM 1.2.0 M2 to use Tomcat 6.0.16 instead of Tomcat 5.5. I used the catalina 6.0.16 and jasper 6.0.16 jars from the temporary Spring-DM repo and it's dependencies and starting up the osgi stack works well. But I run into a classcast exeception as soon as I open my application in the browser. java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:146) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) it seems that the problem is this: Bundle org.springframework.osgi.catalina.osgi (catalina.osgi-6.0.16-20080321.182649-3.jar): - has org.apache.AnnotationProcessor - DOESN'T export the package org.apache - has org.apache.catalina.util.DefaultAnnotationProcessor that implements org.apache.AnnotationProcessor (the one from the catalina bunlde) Bundle org.springframework.osgi.jasper.osgi (jasper.osgi-6.0.16-20080624.095828-1): - has ALSO org.apache.AnnotationProcessor (a second one) - DOES export the package org.apache - Wants to cast org.apache.catalina.util.DefaultAnnotationProcessor to org.apache.AnnotationProcessor (the exported one from the jasper bundle) -> ClassCastException As you can see this can't work. IMHO there should only be one org.apache.AnnotationProcessor. In fact this actually is of course more an error of tomcat 6 that hasn't been noticed because until now there was only one classpath. I also opened an issue for tomcat 6. See: https://issues.apache.org/bugzilla/show_bug.cgi?id=46344

    Spring JIRA | 8 years ago | Roger Villars
    java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
  2. 0

    I tried to reconfigure Spring-DM 1.2.0 M2 to use Tomcat 6.0.16 instead of Tomcat 5.5. I used the catalina 6.0.16 and jasper 6.0.16 jars from the temporary Spring-DM repo and it's dependencies and starting up the osgi stack works well. But I run into a classcast exeception as soon as I open my application in the browser. java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:146) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) it seems that the problem is this: Bundle org.springframework.osgi.catalina.osgi (catalina.osgi-6.0.16-20080321.182649-3.jar): - has org.apache.AnnotationProcessor - DOESN'T export the package org.apache - has org.apache.catalina.util.DefaultAnnotationProcessor that implements org.apache.AnnotationProcessor (the one from the catalina bunlde) Bundle org.springframework.osgi.jasper.osgi (jasper.osgi-6.0.16-20080624.095828-1): - has ALSO org.apache.AnnotationProcessor (a second one) - DOES export the package org.apache - Wants to cast org.apache.catalina.util.DefaultAnnotationProcessor to org.apache.AnnotationProcessor (the exported one from the jasper bundle) -> ClassCastException As you can see this can't work. IMHO there should only be one org.apache.AnnotationProcessor. In fact this actually is of course more an error of tomcat 6 that hasn't been noticed because until now there was only one classpath. I also opened an issue for tomcat 6. See: https://issues.apache.org/bugzilla/show_bug.cgi?id=46344

    Spring JIRA | 8 years ago | Roger Villars
    java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
  3. 0

    Servlet.service() throws ClassCastException

    Stack Overflow | 4 years ago | Rishabh
    java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Porting JSF app from Tomcat 5.5 to 6.0

    Oracle Community | 1 decade ago | 843842
    java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor
  6. 0

    SEVERE: Servlet.service() for servlet jsp threw exception

    Coderanch | 7 years ago | jatinkumar patel
    java.lang.ClassCastException: org.apache.struts.taglib.logic.IterateTei cannot be cast to javax.servlet.jsp.tagext.TagExtraInfo

    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.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor

      at org.apache.jasper.servlet.JspServletWrapper.getServlet()
    2. GWT dev
      JspServlet.service
      1. org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:146)
      2. org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
      3. org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
      4. org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      4 frames
    3. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      1 frame
    4. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      8 frames
    5. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      3 frames
    6. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame