
This seems like a sound solution, but if you can live with JMX 1.2.1, you could also just require Java 1.4 users to include a JMX implementation. Though I can't see any problems with this solution, I'm personally never too keen to see Class.forName in a general library after seeing the problems of applications like commons-logging, especially given the problems it can create in distributed systems. -Andy Gerweck -----Original Message----- From: logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch] On Behalf Of Ceki Gulcu Sent: Thursday, May 03, 2007 11:34 AM To: logback users list Subject: Re: [logback-user] Unable to Initialize Logger in JDK1.4 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@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 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user *************************************************************************** The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system. Thank You. ****************************************************************************