kagent property of StatelessKnowledgeSessionImpl is only used by the kagent
itself. This property is not even exposed through StatelessKnowledgeSession
interface. So I'm not sure whether this should be configurable through
spring or not.
If you are trying to configure a Stateful session from a kbase that is
updated by a kagent, you could try this configuration:
<drools:ksession id="ksession1" type="stateful"
kbase="kbase1"/>
<drools:kbase id="kbase1"/>
<drools:kagent id="kagent1" kbase="kbase1"
new-instance="false">
<drools:resources>
<drools:resource type="DRL" source="....." />
<drools:resource type="DRL" source="....." />
...
</drools:resources>
</drools:kagent>
Best,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
http://www.plugtree.com
- Blog @
http://ilesteban.wordpress.com
On Wed, Feb 23, 2011 at 5:29 PM, mmjose26 <mmjose26(a)yahoo.com.mx> wrote:
Hi,
Im runnung test cases in Spring Drools 5.2M1
and I have this exception:
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean
with name 'ksession2': Error setting property values; nested exception is
org.springframework.beans.NotWritablePropertyException: Invalid property
'knowledgeAgent' of bean class
[org.drools.container.spring.beans.StatefulKnowledgeSessionBeanFactory]:
Bean property 'knowledgeAgent' is not writable or has an invalid setter
method. Does the parameter type of the setter match the return type of the
getter?
it happens with testAgents method
If you change the source code located in the drools-spring component in
class
org.drools.container.spring.namespace.KnowledgeSessionDefinitionParser.java:
// find any kagent's for the current kbase and assign
for ( String beanName :
parserContext.getRegistry().getBeanDefinitionNames() ) {
BeanDefinition def =
parserContext.getRegistry().getBeanDefinition( beanName );
if ( KnowledgeAgentBeanFactory.class.getName().equals(
def.getBeanClassName() ) ) {
PropertyValue pvalue =
def.getPropertyValues().getPropertyValue( "kbase" );
RuntimeBeanReference tbf = (RuntimeBeanReference)
pvalue.getValue();
if ( kbase.equals( tbf.getBeanName() ) ) {
factory.addPropertyValue( "knowledgeAgent",
new RuntimeBeanReference(
beanName ) );
}
}
}
modifying: if ( kbase.equals( tbf.getBeanName() ) &&
"stateless".equals(
sessionType ) )
it works, becasue only stateless sessions have knowledgeAgent property.
is It Correct?
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/spring-drools-api-exc...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users