You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Nellya Udovichenko (JIRA)" <ji...@apache.org> on 2006/08/22 15:37:13 UTC

[jira] Created: (HARMONY-1259) NoClassDefFoundError while working with MX4J loggers

NoClassDefFoundError while working with MX4J loggers 
-----------------------------------------------------

                 Key: HARMONY-1259
                 URL: http://issues.apache.org/jira/browse/HARMONY-1259
             Project: Harmony
          Issue Type: Bug
          Components: App-Oriented Bug Reports
            Reporter: Nellya Udovichenko
            Priority: Minor


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});
			clParam = Class.forName("mx4j.log.CommonsLogger");
			method.invoke(null, new Object[] {clParam.newInstance()});
		} catch (ClassNotFoundException e) {
			System.out.println("MX4J classes aren't found in JDK");
		} 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1259) NoClassDefFoundError while working with MX4J loggers

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1259?page=comments#action_12429707 ] 
            
Nellya Udovichenko commented on HARMONY-1259:
---------------------------------------------

Sorry for unformatted test code. See attached file.

> NoClassDefFoundError while working with MX4J loggers
> ----------------------------------------------------
>
>                 Key: HARMONY-1259
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1259
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports
>            Reporter: Nellya Udovichenko
>            Priority: Minor
>         Attachments: MX4JLoggerTest.java
>
>
> 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});
> 			clParam = Class.forName("mx4j.log.CommonsLogger");
> 			method.invoke(null, new Object[] {clParam.newInstance()});
> 		} catch (ClassNotFoundException e) {
> 			System.out.println("MX4J classes aren't found in JDK");
> 		} 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1259) NoClassDefFoundError while working with MX4J loggers

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1259?page=all ]

Nellya Udovichenko updated HARMONY-1259:
----------------------------------------

    Attachment: MX4JLoggerTest.java

> NoClassDefFoundError while working with MX4J loggers
> ----------------------------------------------------
>
>                 Key: HARMONY-1259
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1259
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports
>            Reporter: Nellya Udovichenko
>            Priority: Minor
>         Attachments: MX4JLoggerTest.java
>
>
> 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});
> 			clParam = Class.forName("mx4j.log.CommonsLogger");
> 			method.invoke(null, new Object[] {clParam.newInstance()});
> 		} catch (ClassNotFoundException e) {
> 			System.out.println("MX4J classes aren't found in JDK");
> 		} 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1259) NoClassDefFoundError while working with MX4J loggers

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1259?page=comments#action_12433439 ] 
            
Geir Magnusson Jr commented on HARMONY-1259:
--------------------------------------------

The solution isn't to include CLOGGING or Log4J in the boot classpath.  Geronimo should include all necessary jars, so I believe we have some issue releated to classloading in DRLVM

> NoClassDefFoundError while working with MX4J loggers
> ----------------------------------------------------
>
>                 Key: HARMONY-1259
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1259
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports
>            Reporter: Nellya Udovichenko
>            Priority: Minor
>         Attachments: MX4JLoggerTest.java
>
>
> 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});
> 			clParam = Class.forName("mx4j.log.CommonsLogger");
> 			method.invoke(null, new Object[] {clParam.newInstance()});
> 		} catch (ClassNotFoundException e) {
> 			System.out.println("MX4J classes aren't found in JDK");
> 		} 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1259) NoClassDefFoundError while working with MX4J loggers

Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1259?page=comments#action_12433462 ] 
            
Mikhail Markov commented on HARMONY-1259:
-----------------------------------------

Geronimo has all necessary jars but does not include commons-logging.jar to the bootclasspath.
I've downloaded mx4j.jar + commons-logging.jar and tried to run MX4JLoggerTest.java on RI:

If i run it on RI with the command (on Windows XP):
    "java -Xbootclasspath/p:mx4j.jar -classpath commons-logging.jar\;. MX4JLoggerTest"
to force RI to use MX4J implementation of JMX then i got the following result:
FAILED with exception:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at mx4j.log.CommonsLogger.setCategory(CommonsLogger.java:27)
        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)

BUT if i run it on RI with the command 
    "java -Xbootclasspath/p:mx4j.jar\;commons-logging.jar MX4JLoggerTest"
then the test passed:
PASSED with exception

So, it seems that the problem is indeed in MX4J implementation.

> NoClassDefFoundError while working with MX4J loggers
> ----------------------------------------------------
>
>                 Key: HARMONY-1259
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1259
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports
>            Reporter: Nellya Udovichenko
>            Priority: Minor
>         Attachments: MX4JLoggerTest.java
>
>
> 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});
> 			clParam = Class.forName("mx4j.log.CommonsLogger");
> 			method.invoke(null, new Object[] {clParam.newInstance()});
> 		} catch (ClassNotFoundException e) {
> 			System.out.println("MX4J classes aren't found in JDK");
> 		} 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira