3 Replies Latest reply on Jul 10, 2011 11:07 AM by ffang

    NullPointer at installing custom feature

    michal.warecki

      Hi,

       

      I wanted to install jBPM 5.1 libraries to servicemix and I have created new very simple feature (attachment)

       

      Next I hotdeploy this feature (I can see it in features list).

      In log file I can see:

      21:01:13,686 | INFO | lixDispatchQueue | FeaturesServiceImpl | 15 - org.apache.karaf.features.core - 2.2.0.fuse-00-39 | Installing feature jbpm 5.1


      21:01:13,753 | ERROR | lixDispatchQueue | FeatureDeploymentListener | 31 - org.apache.karaf.deployer.features - 2.2.0.fuse-00-39 | Unable to install features


      java.lang.NullPointerException


      at org.apache.karaf.features.internal.FeaturesServiceImpl.installBundleIfNeeded(FeaturesServiceImpl.java:660)


      at org.apache.karaf.features.internal.FeaturesServiceImpl.doInstallFeature(FeaturesServiceImpl.java:474)


      at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:292)


      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_21]


      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_21]


      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_21]


      at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_21]


      at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)[8:org.apache.aries.proxy:0.3.0]


      at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)[8:org.apache.aries.proxy:0.3.0]


      at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)[8:org.apache.aries.proxy:0.3.0]


      at $Proxy1.installFeatures(Unknown Source)[15:org.apache.karaf.features.core:2.2.0.fuse-00-39]


      at org.apache.karaf.deployer.features.FeatureDeploymentListener.bundleChanged(FeatureDeploymentListener.java:133)[31:org.apache.karaf.deployer.features:2.2.0.fuse-00-39]


      at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:795)[org.apache.felix.framework-3.0.9-fuse-00-39.jar:]


      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:717)[org.apache.felix.framework-3.0.9-fuse-00-39.jar:]


      at org.apache.felix.framework.util.EventDispatcher.run(EventDispatcher.java:952)[org.apache.felix.framework-3.0.9-fuse-00-39.jar:]


      at org.apache.felix.framework.util.EventDispatcher.access$000(EventDispatcher.java:41)[org.apache.felix.framework-3.0.9-fuse-00-39.jar:]


      at org.apache.felix.framework.util.EventDispatcher$1.run(EventDispatcher.java:93)[org.apache.felix.framework-3.0.9-fuse-00-39.jar:]

       

           at java.lang.Thread.run(Thread.java:619)[:1.6.0_21]

       

       

      I read that jbpm and drools are osgi-ready (http://blog.athico.com/2010/01/drools-osgi-ready.html

      ).

      What I'm doing wrong?

       

      Edited by: michal.warecki on Jul 9, 2011 7:22 PM

        • 1. Re: NullPointer at installing custom feature
          ffang

          Hi,

           

          The NPE is caused by BUNDLE_SYMBOLICNAME is null, further check I found that

          two bundles here

          mvn:org.jbpm/jbpm-bam/5.1.0.Final

          and

          mvn:org.jbpm/jbpm-human-task/5.1.0.Final

          are not osgi friendly, the BUNDLE_SYMBOLICNAME/export-package/import-package isn't in the menifest header, so you need wrap those bundles yourself before you can use it.

           

          Anyway, I think we need make an improvement that in the karaf to throw more meaningful exception instead of the NPE here.

           

          Freeman

          • 2. Re: NullPointer at installing custom feature
            michal.warecki

            Thanks,

             

            jBPM has a lot of external dependencies like drools and drools have a lot of external dependencies those are not osgi bundles (like com.sun.tools.xjc). Is it a simple way to install libraries as a non-osgi libraries (I saw that in lib folder there is ext folder)?

             

            I don't want to spend 4 days wrapping and installing dependencies

             

            Now I have installed a lot of jars (from maven repo) and I stuck with drools core:

             

            Error executing command: Unresolved constraint in bundle org.drools.core :

            Unable to resolve 248.0: missing requirement package; (package=com.sun.t

            ools.xjc).

             

            I have installed it by osgi:install mvn:com.sun.xml.bind/jaxb-xjc but it is now working probably becouse it is not osgi bundle and does't export any packages.

             

            Is it a simple way for installing libraries like jbpm/drools?

            • 3. Re: NullPointer at installing custom feature
              ffang

              Hi,

               

              Servicemix already wrap a lot of bundles which make users life much more easy, including the drools and jaxb-xjc, before you wrap the bundle, you need check what servicemix already offer[1].

               

              If you chose to use OSGi tech, IMHO you should follow the best practice how OSGi works, so spend some time to figure out the dependency and wrap the bundle if necessary is worthy of doing so.

               

              http://repo2.maven.org/maven2/org/apache/servicemix/bundles/

               

              Freeman