2

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. I have log4j 1.2.17 included in the code, which is the most up-to-date version according to 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. It should be left here and NOT marked as duplicate for others who encounter the same problem.

5
  • 1
    Use the version of Log4J that the code was designed to work with. Commented Apr 27, 2015 at 8:27
  • add log4j in your classpath. Commented Apr 27, 2015 at 8:27
  • There is NO ProvisionNode class in log4j 1.2.17 Commented Apr 27, 2015 at 8:28
  • Thanks everybody for the rapid responses. I'm running this code from a compiled .jar file, and I've included the log4j jar in there too - once again, this has run in the past (with the same version of log4j) so it's probably not a structural issue Commented Apr 27, 2015 at 8:32
  • Download Apache logging jar file. It has the ProvisionNode class. Commented Apr 27, 2015 at 8:34

2 Answers 2

3
  1. Download the Apache Logging Jar file
  2. Add the apache-logging-log4j.jar file to your classpath
  3. Clean and build your project.
  4. Run your project
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, just about to try this - should it REPLACE the previous log4j library, or do they both need to be there?
Try replacing it first
This worked! Many thanks for your help. I added the new log4j without removing the other.
0

In my case I forgot to remove <provided> tag from my maven dependencies, so It cannot find anything on local machine

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.