2 Replies Latest reply on Feb 2, 2010 8:04 AM by gvanstad

    log4j not in OSGI bundle path

    gvanstad

      Good day.

       

      I'm deploying an OSGI bundle that requires log4j to be available at runtime.

      Now, I have included log4j as a dependency to my "pom.xml", the bundle builds and deploys perfectly, but when I start the bundle it get this error :

       

      java.lang.NoClassDefFoundError: org/apache/log4j/FileAppender

       

      (This can be any log4J class)

       

      I understand that log4j is part of the FUSE runtime, no how do I make it available to my bundle at runtime.

       

      Any help appreciated

      Regards

      G.

        • 1. Re: log4j not in OSGI bundle path
          njiang

          Are you using ServiceMix 4 as the OSGi platform?

           

          If so it supports the log4j out of box by leverage PAX log.

           

          If not, you need to check if the log4j bundle is installed.

          • 2. Re: log4j not in OSGI bundle path
            gvanstad

            Yes, I'm using Fuse ESB 4 as my OSGI container, but it appears as if only a subset of the log4j framework is available in the classpath.

             

            referencing "org.apache.log4j.Logger" resolves fine,

            but

            referencing "org.apache.log4j.LogManager"

            results in

            java.lang.NoClassDefFoundError: Lorg/apache/log4j/LogManager;

             

            Here's my Pom.xml entry: