Home > Back-end >  NoClassDefFoundError - RuntimeStrSubstitor - Log4j v2.17.2
NoClassDefFoundError - RuntimeStrSubstitor - Log4j v2.17.2

Time:06-21

When upgrading from Log4j v2.17.1 to v2.17.2, JUnit tests immediately begin failing with java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.core.lookup.RuntimeStrSubstitutor

Nothing has been changed in the project other than switching the version number in the POM. Tried checking the Apache website, but couldn't find any useful documentation on the subject or class.

For reference, the unit test looks something like this:

MyClass myClass = new MyClass();    
myClass.myMethod(myObject);

And the class itself starts off like this:

@Repository
public class MyClass implements MyInterface {
    private static Logger LOGGER = LogManager.getLogger(MyClass.class);

This one really has me stumped. If I downgrade to v2.17.1, then no issues whatsoever.. Any ideas or insight? Or even some documentation to help out would be appreciated.

CodePudding user response:

Issue was resolved by also adding slf4j-api v2.0.0-alpha7 and slf4j-simple v2.0.0-alpha7 dependencies.

  • Related