栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

原因:java.lang.NoClassDefFoundError:org / apache / log4j / Logger

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

原因:java.lang.NoClassDefFoundError:org / apache / log4j / Logger

有了@jhadesdev的建议和其他人的解释,我在这里找到了问题。

添加代码以查看各种类加载器可见的内容后,我发现了这一点:

All versions of log4j Logger:   zip:<snip>war/WEB-INF/lib/log4j-1.2.17.jar!/org/apache/log4j/Logger.classAll versions of log4j visible from the classloader of the OAuthAuthorizer class:   zip:<snip>war/WEB-INF/lib/log4j-1.2.17.jar!/org/apache/log4j/Logger.classAll versions of XMLConfigurator:   jar:<snip>com.bea.core.bea.opensaml2_1.0.0.0_6-1-0-0.jar!/org/opensaml/xml/XMLConfigurator.class  zip:<snip>war/WEB-INF/lib/ipp-java-aggcat-v1-devkit-1.0.2.jar!/org/opensaml/xml/XMLConfigurator.class  zip:<snip>war/WEB-INF/lib/xmltooling-1.3.1.jar!/org/opensaml/xml/XMLConfigurator.classAll versions of XMLConfigurator visible from the classloader of the OAuthAuthorizer class:   jar:<snip>com.bea.core.bea.opensaml2_1.0.0.0_6-1-0-0.jar!/org/opensaml/xml/XMLConfigurator.class  zip:<snip>war/WEB-INF/lib/ipp-java-aggcat-v1-devkit-1.0.2.jar!/org/opensaml/xml/XMLConfigurator.class  zip:<snip>war/WEB-INF/lib/xmltooling-1.3.1.jar!/org/opensaml/xml/XMLConfigurator.class

我注意到另一个版本的XMLConfigurator可能会被使用。我对该类进行了反编译,并在第60行找到了该类(该错误在原始堆栈跟踪中)

privatestatic final Logger log =Logger.getLogger(XMLConfigurator.class);
,并且该类是从中导入的
org.apache.log4j.Logger

因此,正是此类被加载和使用。我的解决方法是重命名包含此文件的jar文件,因为我找不到我明确或间接加载它的位置。在我实际部署时可能会造成问题。

感谢您提供的所有帮助以及有关课程加载的急需的课程。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/401912.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号