简体   繁体   English

线程“主”java.lang.NoClassDefFoundError 中的异常:org/apache/log4j/ProvisionNode

[英]Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/ProvisionNode

I'm running some very old legacy code, which has worked in the past.我正在运行一些非常古老的遗留代码,这些代码过去一直有效。 This time, it's giving me the following error这一次,它给了我以下错误

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/ProvisionNode

The line that causes the error is导致错误的行是

public static org.apache.log4j.Logger getLogger(java.lang.String name) { /* compiled code */ }

in the Logger class defined by log4j.在 log4j 定义的 Logger 类中。 I have log4j 1.2.17 included in the code, which is the most up-to-date version according to maven .我在代码中包含 log4j 1.2.17,这是根据maven的最新版本。

Has anyone else seen this error?有没有其他人看到这个错误? Any idea what it could be?知道它可能是什么吗? Thanks!!谢谢!!

Please note this problem has now been solved, the solution accepted below solves the problem.请注意这个问题现在已经解决了,下面接受的解决方案解决了这个问题。 This is a specific issue with the ProvisionNode class, which is found in only certain log4j libraries.这是ProvisionNode类的一个特定问题,该类仅存在于某些 log4j 库中。 It should be left here and NOT marked as duplicate for others who encounter the same problem.对于遇到相同问题的其他人,它应该留在这里并且不标记为重复。

  1. Download the Apache Logging Jar file下载Apache 日志记录 Jar文件
  2. Add the apache-logging-log4j.jar file to your classpath将 apache-logging-log4j.jar 文件添加到您的类路径
  3. Clean and build your project.清理并构建您的项目。
  4. Run your project运行你的项目

在我的情况下,我忘记从我的 Maven 依赖项中删除<provided>标记,所以它在本地机器上找不到任何东西

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“主”中的异常java.lang.NoClassDefFoundError:org / apache / logging / log4j / LogManager - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager 线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / logging / log4j / message / Message - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/logging/log4j/message/Message Scala:线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / log4j / LogManager - Scala : Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/log4j/LogManager 线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/log4j/Layout - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/log4j/Layout 线程“JavaFX 应用程序线程”中的 JavaFx 异常 线程“主”java.lang.NoClassDefFoundError 中的异常:org/apache/log4j/Logger - JavaFx Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger 线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/log4j/Logger 在创建可执行 JAR 后,但这是一个 JAVA 项目 - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger after creating an executable JAR but this is a JAVA Project 线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / log4j / Layout-从命令提示符处运行Runnig JAR时 - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/log4j/Layout - While Runnig JAR from Command Prompt java.lang.NoClassDefFoundError:org / apache / log4j / Priority - java.lang.NoClassDefFoundError: org/apache/log4j/Priority java.lang.NoClassDefFoundError:org / apache / log4j / Priority - java.lang.NoClassDefFoundError: org/apache/log4j/Priority java.lang.NoClassDefFoundError:org / apache / log4j / PropertyConfigurator - java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM