[jboss-jira] [JBoss JIRA] (DROOLS-845) @KSession throws exception when using kmodule in separate jar

Andreas Marksteiner (JIRA) issues at jboss.org
Tue Jun 14 16:49:00 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13252474#comment-13252474 ] 

Andreas Marksteiner commented on DROOLS-845:
--------------------------------------------

Any findings here? I have exactly the same issue, as described by [~lpiccoli] in the referenced stackoverflow question.

I have a working setup with a spring application-context.xml using the kie:kmodule and kie:kbase tags.

Now I moved my drl and xls (using the spreadsheet compiler) to a maven artifact and load from the corresponding jar with the kie:import tag.

The jar content is picked up and if I use in my code KieServices.Factory.get() to get a KBase everthing works fine.

I would like to use the KBase annotation - but this results in a NPE when spring tries to inject the KBase.

> @KSession throws exception when using kmodule in separate jar
> -------------------------------------------------------------
>
>                 Key: DROOLS-845
>                 URL: https://issues.jboss.org/browse/DROOLS-845
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine, decision tables, kie server
>    Affects Versions: 6.2.0.Final
>         Environment: windows 7
>            Reporter: lucio piccoli
>            Assignee: Mario Fusco
>         Attachments: drools-bug.zip
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list