Details
-
Bug
-
Resolution: Fixed
-
None
-
1.5.x
-
None
-
Operating System: Windows XP
Platform: PC
-
blocker
-
P1
-
146
Description
I got this exception when I run my class in Eclipse:
log = LoggerFactory.getLogger(SilenceInstall.class);
Exception in thread "main" java.lang.NullPointerException
at org.slf4j.LoggerFactory.singleImplementationSanityCheck(LoggerFactory.java:192)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:113)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
at
com.foo.installation.SilenceInstall.main(SilenceInstall.java:99)
It is due to LoggerFactory.class.getClassLoader() returns null in:
private static void singleImplementationSanityCheck() {
try {
Enumeration paths = LoggerFactory.class.getClassLoader().getResources(
STATIC_LOGGER_BINDER_PATH);
....
According to JavaDoc, getClassLoader() can be null: "Some implementations may use null to represent the bootstrap class loader. "