Friday, November 11, 2011

Failed to instantiate SLF4J LoggerFactory Reported exception

if you get below mentioned error


Failed to instantiate SLF4J LoggerFactory Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
        at org.quartz.impl.StdSchedulerFactory.(StdSchedulerFactory.java:274)
        at com.hewitt.hre.scheduler.ScheduleJob.main(ScheduleJob.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 7 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
        at org.quartz.impl.StdSchedulerFactory.(StdSchedulerFactory.java:274)
        at com.hewitt.hre.scheduler.ScheduleJob.main(ScheduleJob.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 7 more



Possible reason could be you have forgot to set log4j.jar in classpath. Please try adding log4j JAR file (e.g. log4j-1.2.14.jar) in classpath.

No comments:

Post a Comment