[logback-user] Unable to Initialize Logger in JDK1.4
Ceki Gulcu
listid at qos.ch
Thu May 3 20:34:23 CEST 2007
I am happy to report that this problem has been fixed in commit r1520.
For more details see [1]. It should be available with the next
version of logback, namely 0.9.6.
[1] http://www.qos.ch/pipermail/logback-dev/2007-May/001915.html
Ceki Gulcu wrote:
> Hi Brian,
>
> Raphael and I spent a few minutes studying your bug report.
>
> Placing slf4j-jdk14-1.3.0.jar makes the problem harder to reproduce
> because if slf4j-jdk14-1.3.0.jar comes before
> logback-classic-0.9.5-jdk14.jar, then logback classes cannot be seen by
> SLF4J API.
>
> Removing slf4j-jdk14-1.3.0.jar is necessary but not sufficient to
> reproduce the problem. You also need a logback-test.xml or logback.xml
> file available somewhere on the class path. When these conditions are
> fulfilled, then we observe the NoClassDefFoundError you reported which
> can be explained as follows.
>
> We recently added a new component to Joran, namely
> JMXConfiguratorAction, which requires JMX support (available in JDK
> 1.5). When logback is loaded into memory, it will check whether the
> aforementioned configuration files are available on the class path. If
> so, logback will create an instance of Joran to parse the config file.
> However, to load Joran one needs JMXConfiguratorAction which in turn
> requires JMX, hence the exception.
>
> We can attempt to fix this bug by loading JMXConfiguratorAction only
> under JDK 1.5. We'll let you know how it goes.
>
> Thanks for using logback.
>
>
> Brian Suksomwong wrote:
>> Hey all,
>>
>> I'm trying to test logback's JDK1.4 support, but am receiving a
>> NoClassDefNotFoundException when running my test class.
>>
>> Test Class:
>> import org.slf4j.Logger;
>> import org.slf4j.LoggerFactory ;
>>
>> public Test {
>> public static void main(String args[]) {
>> Logger log = LoggerFactory.getLogger(Test.class);
>> System.out.prinln(log.getName());
>> }
>> }
>>
>> My classpath includes:
>> logback-classic-0.9.5-jdk14.jar
>> logback-core-0.9.5-jdk14.jar
>> slf4j-api-1.3.0.jar
>> slf4j-jdk14-1.3.0.jar (just in case, but I receive the same error
>> without it)
>>
>> When I try to run the class I receive the following stack trace:
>> java.lang.NoClassDefFoundError : javax/management/ObjectName
>> at
>> ch.qos.logback.classic.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:62)
>>
>> at
>> ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java
>> :83)
>> at
>> ch.qos.logback.core.joran.JoranConfiguratorBase.buildInterpreter(JoranConfiguratorBase.java:82)
>>
>> at
>> ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:95)
>>
>> at ch.qos.logback.core.joran.GenericConfigurator.doConfigure
>> (GenericConfigurator.java:74)
>> at
>> ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:38)
>>
>> at
>> ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java
>> :24)
>> at
>> ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:35)
>>
>> at
>> ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:46)
>>
>> at org.slf4j.impl.StaticLoggerBinder.initialize
>> (StaticLoggerBinder.java:52)
>> at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:44)
>> at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:39)
>> at org.slf4j.LoggerFactory .<clinit>(LoggerFactory.java:57)
>> at Test.main(Test.java:6)
>> ... Removed 21 stack frames
>>
>>
>> The javax/management package is not in JDK1.4, but is in JDK1.5. I
>> think there is a binding issue happening; please help me solve this
>> issue if possible.
>>
>>
>> Thanks!
>>
>> -B-
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the Logback-user
mailing list