Kie-spring Issues - Not able to autowire sessions

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Kie-spring Issues - Not able to autowire sessions

mattmadhavan
Hello,
I have the following kie-spring xml definition to test my custom evaluater.

	<kie:kmodule id="kbase_inlist_op_test_rules">
		<kie:kbase name="IN_LIST_KBase" packages="org.facs.ncdb.drools.utils">
			<kie:ksession name="IN_LIST_KSession" type="stateless" scope="prototype"/>
		</kie:kbase>
	</kie:kmodule>

	<bean id="kiePostProcessor" class="org.kie.spring.KModuleBeanFactoryPostProcessor" />

I am not able to inject neither the IN_LIST_KBase nor the IN_LIST_KSession in my test class as follows:

   
            @Autowired
	    @Qualifier("IN_LIST_KSession")
	    StatelessKieSession  IN_LIST_KSession;	
	    
	    @Autowired
	    @Qualifier("IN_LIST_KBase")
	    private KieBase kbase;

But i am able to look it up via the applicationContext as follows:
	    @BeforeClass
	    public static void setup() {
	        context = new ClassPathXmlApplicationContext("applicationContext/kmodule-spring-inlist-operator-test.xml");
               this.IN_LIST_KSession =  (StatelessKieSession) context.getBean("IN_LIST_KSession");
	    }


I am bit confused! Any ideas please?

Thanks in advance!

Matt'M
Reply | Threaded
Open this post in threaded view
|

Re: Kie-spring Issues - Not able to autowire sessions

Vinod Kiran
If you are using 6.1 final, you could try changing the kiePostProcessor to

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

and the annotations to

@KSession("IN_LIST_KSession")
StatelessKieSession ksession1;

@KBase("IN_LIST_KBase")
KieBase kieBase;
Reply | Threaded
Open this post in threaded view
|

Re: Kie-spring Issues - Not able to autowire sessions

mattmadhavan
Hi Vinod,
Thanks for your answer. I am using Drools 6.1.0.Final and I changed the postprocessor to the on you suggested. Its still not working. Any ideas?

Thanks
Matt
Reply | Threaded
Open this post in threaded view
|

Re: Kie-spring Issues - Not able to autowire sessions

Vinod Kiran
Matt,

Take a look at the following and check if these tests work fine in your local
https://github.com/vinodkiran/droolsjbpm-integration/blob/master/kie-spring/src/test/java/org/kie/spring/beans/annotations/NamedKieBean.java

https://github.com/vinodkiran/droolsjbpm-integration/blob/master/kie-spring/src/test/java/org/kie/spring/tests/annotations/NamedInjectionTest.java

Additionally, Do you see any specific errors?

-Vinod

Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Kie-spring Issues - Not able to autowire sessions

Ged Byrne
In reply to this post by mattmadhavan
Hi Matt,

This may be a problem with Spring rather than KIE.

Take a look at the following:

Regards, 


Ged



On 16 August 2014 18:56, mattmadhavan <[hidden email]> wrote:
Hello,
I have the following kie-spring xml definition to test my custom evaluater.



I am not able to inject neither the *IN_LIST_KBase *nor the
/IN_LIST_KSession/ in my test class as follows:



But i am able to look it up via the applicationContext as follows:


I am bit confused! Any ideas please?

Thanks in advance!

Matt'M



--
View this message in context: http://drools.46999.n3.nabble.com/Kie-spring-Issues-Not-able-to-autowire-sessions-tp4030663.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Kie-spring Issues - Not able to autowire sessions

Stephen Masters
May be worth checking what class/interface your bean is. In the code that works, you are casting it to StatelessKieSession, but I suspect that the object which was injected was a KieSession.

Steve



On 19 Aug 2014, at 15:17, Ged Byrne <[hidden email]> wrote:

Hi Matt,

This may be a problem with Spring rather than KIE.

Take a look at the following:

Regards, 


Ged



On 16 August 2014 18:56, mattmadhavan <[hidden email]> wrote:
Hello,
I have the following kie-spring xml definition to test my custom evaluater.



I am not able to inject neither the *IN_LIST_KBase *nor the
/IN_LIST_KSession/ in my test class as follows:



But i am able to look it up via the applicationContext as follows:


I am bit confused! Any ideas please?

Thanks in advance!

Matt'M



--
View this message in context: http://drools.46999.n3.nabble.com/Kie-spring-Issues-Not-able-to-autowire-sessions-tp4030663.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

[rules-users] Moved to Google Groups

Mark Proctor
Just a reminder this list has moved to Google Groups:

Mark

On 20 Aug 2014, at 22:27, Stephen Masters <[hidden email]> wrote:

May be worth checking what class/interface your bean is. In the code that works, you are casting it to StatelessKieSession, but I suspect that the object which was injected was a KieSession.

Steve



On 19 Aug 2014, at 15:17, Ged Byrne <[hidden email]> wrote:

Hi Matt,

This may be a problem with Spring rather than KIE.

Take a look at the following:

Regards, 


Ged



On 16 August 2014 18:56, mattmadhavan <[hidden email]> wrote:
Hello,
I have the following kie-spring xml definition to test my custom evaluater.



I am not able to inject neither the *IN_LIST_KBase *nor the
/IN_LIST_KSession/ in my test class as follows:



But i am able to look it up via the applicationContext as follows:


I am bit confused! Any ideas please?

Thanks in advance!

Matt'M



--
View this message in context: http://drools.46999.n3.nabble.com/Kie-spring-Issues-Not-able-to-autowire-sessions-tp4030663.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users