Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-743

Thread.currentThread().getContextClassLoader() in Logger is problematic in OSGi environment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0-RC-1
    • None
    • jaxrs
    • None

      RESTEasy fails to initialize in OSGi environment (Karaf + Felix) because logger provider class cannot be properly determined.

      Thread.currentThread().getContextClassLoader() in Logger class is used to lookup logger provider class (JUL, Log4J or SLF4J). The problem is that thread context class loader is not the bundler loader and thus cannot find JULLogger, Log4JLogger or Slf4jLogger.

      The workaround is to set context loader by calling Thread.currentThread.setContextClassLoader() passing in appropriate class loader as an argument. This will force lookup of the class to succeed.

            patriot1burke@gmail.com Bill Burke (Inactive)
            flush_dia Vladimir Tsukur (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: