OpenEJB
  1. OpenEJB
  2. OPENEJB-1111

PAX friendly LogStreamFactory for use in OSGi environments

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.3
    • Component/s: osgi
    • Labels:
      None

      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

      { factoryClass = classLoader.loadClass(factoryName); }

      catch (ClassNotFoundException e) {
      }
      }

      if (factoryClass != null) {
      try

      { factoryClass = Class.forName(factoryName); }

      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 !=.

        Activity

          People

          • Assignee:
            Rick McGuire
            Reporter:
            Rick McGuire
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development