Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-176

NPE is created when a kie-spring project is deployed on OSGI - Karaf runtime

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.0.CR3
    • 6.0.0.Beta3
    • None
    • None

      Hi,

      When the following drools + camel example is deployed on Apache Karaf :

      https://github.com/droolsjbpm/droolsjbpm-integration/tree/master/drools-osgi/droolsjbpm-osgi-examples/spring-camel-drools-decision-table

      features:addurl mvn:org.drools/drools-karaf-features/6.0.0-SNAPSHOT/xml/features
      features:install drools-module
      features:install drools-decisiontable
      features:install kie-spring
      features:install kie-camel
      features:install drools-camel-example

      Then, the following exception is created :

      2013-06-21 09:42:34,649 | ERROR | ExtenderThread-2 | ClasspathKieProject              | builder.impl.ClasspathKieProject   93 | 80 - org.drools.compiler - 6.0.0.20130621-0836 | Unable to build index of kmodule.xml url=bundle://212.1:1/META-INF/kmodule.xml
      It is necessary to have the drools-osgi-integration module on the path in order to create a KieProject from an ogsi bundle
      2013-06-21 09:42:34,651 | INFO  | ExtenderThread-2 | DefaultListableBeanFactory       | ort.DefaultSingletonBeanRegistry  422 | 91 - org.springframework.beans - 3.0.7.RELEASE | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12b7530: defining beans [droolsHelper,personHelper,ksession-dt-1,AgeVerification,camel-1:beanPostProcessor,camel-1,ksession1,camel-2:beanPostProcessor,camel-2]; root of factory hierarchy
      2013-06-21 09:42:34,661 | ERROR | ExtenderThread-2 | ContextLoaderListener            | BundleApplicationContextListener   50 | 131 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.drools.camel-example, config=osgibundle:/META-INF/spring/*.xml))
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ksession-dt-1': Invocation of init method failed; nested exception is java.lang.NullPointerException
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)[91:org.springframework.beans:3.0.7.RELEASE]
      	at 
      ...
      Caused by: java.lang.NullPointerException
      	at org.kie.spring.KieObjectsResolver.resolveKSession(KieObjectsResolver.java:69)[125:org.kie.spring:6.0.0.20130620-0250]
      	at org.kie.spring.factorybeans.KSessionFactoryBean.afterPropertiesSet(KSessionFactoryBean.java:146)[125:org.kie.spring:6.0.0.20130620-0250]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)[91:org.springframework.beans:3.0.7.RELEASE]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)[91:org.springframework.beans:3.0.7.RELEASE]
      	... 14 more
      

      It seems that we have 2 issues :

      1) Even if drools-osgi-integration (fragment bundle) is deployed and classes added to the classloader of drools-compiler, the following error is reported :

      2013-06-21 09:42:34,649 | ERROR | ExtenderThread-2 | ClasspathKieProject | builder.impl.ClasspathKieProject 93 | 80 - org.drools.compiler - 6.0.0.20130621-0836 | Unable to build index of kmodule.xml url=bundle://212.1:1/META-INF/kmodule.xml

      2) During the creation of kcontainer, something happens as the Map of GAVs is equal to zero, reason why we get a NPE

            mfusco@redhat.com Mario Fusco
            cmoullia Charles Moulliard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: