ClassCastException+spring

发布于 2024-12-27 12:35:32 字数 206 浏览 5 评论 0原文

您好,我遇到以下错误,请告诉我解决方案

java.lang.ClassCastException:org.apache.catalina.util.DefaultAnnotationProcessor 无法转换为 org.apache.AnnotationProcessor –

我使用 tomcat 6.0

Hi following error I have got please let me know solution

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

Im using tomcat 6.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南渊 2025-01-03 12:35:32

这是一个已知问题。原因是这样的:

这是由于 MYFACES-1246 的努力,注释提案
在列表中处理(添加方法),但这当然会破坏
相同命名接口的兼容性。

如果您有使用 org.apache.AnnotationProcessor 的旧代码,您可以
它可以在 Tomcat 上运行。

解决方案是:

添加到 tomcat/conf 目录中的 context.xml 文件(Context 元素)中。

这使得 Tomcat 中的类加载遵循 J2EE 规范。
(我无法仅使用 1 个 web 应用程序的建议方法来使其工作)

这是参考:http://mail-archives.apache.org/mod_mbox/myfaces-dev/200703.mbox/%[电子邮件受保护]%3E

This is a known issue. This is the reason:

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.

Solution is:

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)

This is the reference: http://mail-archives.apache.org/mod_mbox/myfaces-dev/200703.mbox/%[email protected]%3E

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文