solve ClassCastException of AnnotationProcessor

[url]http://mqqqvpppm.iteye.com/blog/220254[/url]
my project throw the following exception in tomcat6:

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


Solution:

(this is an expert's mail)
-----------------------------------------------------------------------
this problem is not easy to solve - some1 commited "patch" to refactor
AnnotationProcessor interface to NOW wrong package.
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

When using new code from trunk, it needs quite a lot changes to make it
work in Tomcat (i can provide patch if wanted).

Regards,
Zdenek

出现这个问题多半是把tomcat6 lib目录下的jar文件复制到了项目lib目录下了,只需要把这些多余的jar包从项目lib目录下去掉就行了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值