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.