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

@KSession throws exception when using kmodule in separate jar

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 6.2.0.Final
    • None
    • windows 7

      i am using drools with a kmodules.xml and decisiontable inside a separate jar file. when i attempt to bind the @KSession to the spring application context it throws an nullpointer exception deep inside the annotation.

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oft.onlineservice.business.FeeRulesEngineTest': Injection of kie dependencies failed; nested exception is java.lang.NullPointerException
      at org.kie.spring.annotations.AnnotationsPostProcessor.postProcessPropertyValues(AnnotationsPostProcessor.java:109)
      using a simple junittest shows the problem.

      public class FeeRulesEngineTest {

      @KSession( "ksession1")
      private StatelessKieSession ksession;

      @KBase("feeDecisionTable")
      private KieBase kbase;
      the kmodule.xml

      <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
      <kbase name="feeDecisionTable" packages="oft.rulesengine" default="true">
      <ksession name="ksession1" type="stateless" default="true" >
      </ksession>
      </kbase>
      </kmodule>
      the spring config is using the annonation postprocessor.

      <kie:import />
      <bean id="kiePostProcessor"
      class="org.kie.spring.annotations.KModuleAnnotationPostProcessor"/>

      my curent work around to is to use @Autowire for the KSession and KBase.

              mfusco@redhat.com Mario Fusco
              lpiccoli_jira lucio piccoli (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: