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

Source: Internet
Author: User
Tags apache tomcat

An exception occurred while running the program:

An exception occurred:

HTTP Status-

Type Exception

Message

Description The server encountered an internal error () is prevented it from fulfilling this request.

exception

Org.apache.jasper.JasperException:java.lang.ClassCastException: Org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to Org.apache.AnnotationProcessor
	Org.apache.jasper.servlet.JspServletWrapper.getServlet (jspservletwrapper.java:161)
	Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:338)
	Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:313)
	Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:260)
	Javax.servlet.http.HttpServlet.service ( httpservlet.java:717)

Root cause

Java.lang.ClassCastException:org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to Org.apache.AnnotationProcessor
	Org.apache.jasper.servlet.JspServletWrapper.getServlet ( jspservletwrapper.java:151)
	Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:338 )
	Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:313)
	Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:260)
	Javax.servlet.http.HttpServlet.service ( httpservlet.java:717)

Note the "Full stack" trace of the root cause is available in the Apache tomcat/6.0.30 logs. Apache tomcat/6.0.30

Reason analysis:

Tomcat Catalina.jar and Jasper.jar all have the Annotationprocessor interface, so the runtime, there is an error: Java.lang.ClassCastException: Org.apache.catalina.util.DefaultAnnotationProcessor.

Workaround for Exceptions:

Add <loader delegate= "true"/> in the Context.xml file in Tomcat. ~

Ps:

The Loader object can appear in the context to control the loading of Java classes. Although it is possible to change the Loadet class, it is generally not done, so in the following properties we list the properties that are accepted by the standard and generic class loaders.

Properties: ClassName, meaning: Org.apache.catalina.Loader implementation class name, default value: Org.apache.catalina.loader.WebappClassLoader

Properties: Delegate, meaning: True represents the use of the formal Java proxy pattern (asking for the loader of the parent class first); False represents first in the Web application. Warning: Do not change this property value, default value if you do not know how to handle it: FALSE

Properties: Loaderclass, meaning: class loader, default value: Org.apache.catalina.loader.WebappClassLoader

Attributes: reloadable, meaning: the same meaning as in the context. The value at this time overwrites the value in the context, the default value: FALSE

    properties: Workdir, meaning: directories that hold temporary files, default values: temporary directories under catalina_base (if Catalina_tome values are not displayed, Catalina_base)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.