title: Servlet.service() throws ClassCastException
body: <p>I have a java web application. I have set up this new project and getting the following exception when I run a jsp,</p>
  
  <pre><code>Oct 10, 2012 3:01:49 AM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet jsp threw exception
  java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
      at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:151)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      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:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      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:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:619)
  Oct 10, 2012 3:01:57 AM org.apache.catalina.loader.WebappClassLoader modified
  INFO:     Additional JARs have been added : 'activation-1.1.jar'
  Oct 10, 2012 3:01:57 AM org.apache.catalina.core.StandardContext reload
  INFO: Reloading this Context has started
  Oct 10, 2012 3:01:57 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
  SEVERE: The web application [/AutoUpgrade] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
  Oct 10, 2012 3:01:57 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
  SEVERE: The web application [/AutoUpgrade] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
  </code></pre>
  
  <p>I have tried clean and building the project many times, getting the latest service-api.jar, my lib is very extensive and I cannot figure out whether there is any inconsistencies between any jar that is causing this error. I am running the project on Apache Tomcat 6 on jdk 1.6 (my project needs to run on 1.6). I have tried googling this exception, but didnt get any post relevant to my problem. The relevant questions on stackoverflow talk about NullPointerException.</p>
  
  <p>I think the problem must be with my library, but I can not point to root cause.</p>
  
  <p>Thanks</p>