2 Replies Latest reply on Apr 2, 2009 9:17 PM by Oliver Newell

    Error related to PaxLogging and java.util.logging

    Oliver Newell Newbie

      Hi -

       

      I'm trying to deploy a module in SMX4, and am seeing an error that appears related to the PaxLogging module. It looks like one of the imported OSGi bundles uses the java.util.logging package, and when a call is made there is a NullPointerException.  Is there anything special that needs to be done (perhaps to the org.ops4j.pax.logging.cfg file?) to enable logging via the java.util.logging package?

       

       

              at java.lang.Thread.run(Thread.java:619)

      Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class : Constructor threw exception; nested exception is java.lang.NullPointer Exception

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)

              at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:87)

              at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolve r.java:248)

              ... 16 more

      Caused by: java.lang.NullPointerException

              at org.apache.log4j.CategoryKey.(WebCoverageServiceImpl.java:178)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)

              ... 18 more

        • 1. Re: Error related to PaxLogging and java.util.logging
          Torsten Mielke Apprentice

          Hhm, rather strange. What version of the SMX4 kernel do you use?

           

          I have built a quick OSGI bundle testcase with an Activator that uses java.util.logging and can see the logging working fine and written correctly.

           

          Is your org.ops4j.pax.logging.cfg config different from the default?

           

          Btw, pax logging will register a JdkHandler that redirects any java.util.logging to its own logging (which in ServiceMix4 is done via log4j).

           

          Edited by: tmielke on Apr 2, 2009 2:40 PM

          • 2. Re: Error related to PaxLogging and java.util.logging
            Oliver Newell Newbie

            Hi -

             

            Thanks for the response. I'm using version 4.0.0.4 of SMX.

             

            I'm still climbing the familiarity curve with OSGi.  It turns out that some of the 3rd party Jars (geotools) I am linking with are split into multiple modules, some of which are meant to share the same singleton instances (causes somewhat unpredictable behavior when deployed as separate bundles). The modules also have some sort of logging layer and try to do clever things with class loading.

             

            When I integrated the geotools modules into my application bundle so they share the same class loader, the error went away. 

             

            Thanks for doing the test ... Sorry for the false alarm!

             

            -Oliver