본문 바로가기

IT-Consultant

Problem u& solution of using org.apache.AnnotationProcessor in Tomcat 6

개발환경 구축중에 이런 에러가 발생하였다.
org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor

원인은 Annotation의 버전차이였고 해결책은 context.xml 파일을 수정하는 것이였다. 아니면 버전을 올려되 된다.  


Problem u& solution of using org.apache.AnnotationProcessor in Tomcat 6

Published on Thu 12 Jul 2007 07:07 ( 1 year, 6 months ago)

When I run a project which was worked fine in Tomcat 5.5 on Tomcat 6.0, some error bumped out:

 Jul 12, 2007 3:01:11 PM com.xxxx.xxx.xxx.RendererException <init>
SEVERE: Couldn't include the view: '/WEB-INF/templates/jsp/xxx.jsp'. java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor

Found the reason & solution here:

This was due to efforts from MYFACES-1246, proposal of annotation 
processing here in list (adding method), but this of course breaks
compatibility of the same named interfaces.

If you have older code using org.apache.AnnotationProcessor you can make
it work on Tomcat:

Add

<Loader delegate="true"/>

into context.xml file (to Context element) in tomcat/conf directory.
This makes classloading in Tomcat sticking to J2EE spec.
(I couldn't make it work with suggested approach for only 1 webapp)

More info on classloader:
http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html