Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
MX4J has the logging system that allows redirecting the log calls to Commons Logging or Log4J systems and mx4j.jar file is included to the bootclasspath.
However, there are no jar files of Commons Logging (commons-logging.jar) and Log4J (log4j.jar) projects in Harmony bootclasspath.
Therefore, NoClassDefFoundError occurs while using MX4J logging system. This problem appears during Geronimo launching with Harmony.
Below is the localized test case for easy bug reproducing:
-----------------------------------------------------------------------------------------------------------------------------------------------------
import java.lang.reflect.Method;
import java.util.ArrayList;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
public class MX4JLoggerTest {
public static void main(String[] args) {
try {
Class cl = Class.forName("mx4j.log.Log");
Class clParam = Class.forName("mx4j.log.Logger");
Method method = cl.getDeclaredMethod("redirectTo", new Class[]
);
clParam = Class.forName("mx4j.log.CommonsLogger");
method.invoke(null, new Object[]
);
} catch (ClassNotFoundException e)
catch (Exception e)
{ System.out.println("Exception: it can't force MX4J to use commons.logging classes"); }try
{ ArrayList servers = MBeanServerFactory.findMBeanServer("test"); System.out.println("PASSED"); }catch (NoClassDefFoundError e)
{ System.out.println("FAILED with exception:"); e.printStackTrace(); }catch (Exception e)
{ System.out.println("PASSED with exception"); } }
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
Test output.
Harmony with commons-logging.jar added to classpath (not bootclasspath):
C:\>java -cp C:\commons-logger.jar; MX4JLoggerTest
FAILED with exception:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at mx4j.log.Log.createLogger(Log.java:211)
at mx4j.log.Log.getLogger(Log.java:180)
at javax.management.MBeanServerFactory.getLogger(MBeanServerFactory.java:34)
at javax.management.MBeanServerFactory.findMBeanServer(MBeanServerFactory.java:105)
at MX4JLoggerTest.main(MX4JloggerTest.java:24)
Harmony with commons-logging.jar added to bootclasspath:
C:\>java MX4JLoggerTest
PASSED with exception
Attachments
Attachments
Issue Links
- duplicates
-
HARMONY-1411 [app] Geronimo 1.1 can't start correctly - can't find commons logging dependency
- Closed
- relates to
-
GERONIMO-2595 Hardcoded MX4J logger in org.apache.geronimo.kernel.log.GeronimoLogging class
- Closed