[rules-users] Drools-Spring Config for Knowledge Agent

krkaleraj krkaleraj at gmail.com
Wed Oct 13 18:51:48 EDT 2010


Hello Esteban,

NOTHING CHANGES. Same issue continuous. Please check the exception stack
trace in the post beginning by Kiran. We can not use 5.2 at the snapshot
stage. Please let us know the work around. 

excerpt of my bean.xml is below...

<drools:kagent id="kagent1" kbase="kbProcessWorkItems" new-instance="true"
/>
	
<drools:kbase id="kbProcessWorkItems" node="node1">
	    <drools:resources>
			<drools:resource type="PKG"
source="file:///${temp.dir}/processWorkItems.pkg" />
		</drools:resources>
	</drools:kbase>

	
	<bean id="myEmf"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="ds" />
		<property name="persistenceUnitName"
value="org.drools.persistence.jpa.local" />
	</bean>

	<bean id="txManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="myEmf" />
	</bean>
    
	<drools:ksession id="jpaSingleSessionCommandService" type="stateful" 
kbase="kbProcessWorkItems">
	    <drools:configuration>
			<drools:jpa-persistence>
	            <drools:transaction-manager ref="txManager" />
	            <drools:entity-manager-factory ref="myEmf" />   	    
		    </drools:jpa-persistence>
	    </drools:configuration>		    
	</drools:ksession>

My java code excerpt...
  KnowledgeAgentImpl kagent1 = (KnowledgeAgentImpl) ctx.getBean("kagent1");    
        log.info( "---> get bean jpaSingleSessionCommandService" );
//        StatefulKnowledgeSession service = (StatefulKnowledgeSession)
ctx.getBean( "jpaSingleSessionCommandService" );

        StatefulKnowledgeSession service = 
kagent1.getKnowledgeBase().newStatefulKnowledgeSession();
        log.info( "---> create new SingleSessionCommandService" );

        int sessionId = service.getId();
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Spring-Config-for-Knowledge-Agent-tp1634280p1697685.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list