Description
When used in an OSGi enabled environment where PAX logging is the enabled logging environment, the openejb components have problems because of a NoClassDefFound exception when attempting to initialize the logging environment. The PAX logging implementation provides a subset of the log APIs, but not the APIs for configuring the loggins environment. Because of these missing classes, the default Log4jLogStreamFactory class can't be loaded, resulting in a runtime exception. Openejb should have a more PAX friendly log stream factory available as an option.
Also, there's a small bug in the Logger code that initlizes the environment. The following code
public static void configure() {
String factoryName = System.getProperty("openejb.log.factory");
Class<?> factoryClass = null;
if (factoryName != null) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
try
catch (ClassNotFoundException e) {
}
}
if (factoryClass != null) {
try
catch (ClassNotFoundException e) {
}
}
}
Will load the factoryClass using the context class loader, and if that is successful, will load again using Class.forName(), wiping out the first load event. The factoryClass test should be ==, not !=.