JBoss Community

Re: Problem installation jbpm5 with spring beans

created by jose mendoza in jBPM - View the full discussion

I have the same problem with simple test case using Spring + drools +guvrnor.

debuging the spring-drools jar,  I found that KnowledgeSessionDefinitionParser is the problem.

Here the code:

....

......

        // find any kagent's for the current kbase and assign

        for ( String beanName : parserContext.getRegistry().getBeanDefinitionNames() ) {

            BeanDefinition def = parserContext.getRegistry().getBeanDefinition(beanName);

            if ( def.getBeanClassName().equals( KnowledgeAgentBeanFactory.class.getName() ) ) {                               

                 PropertyValue pvalue = def.getPropertyValues().getPropertyValue( "kbase" );

                 RuntimeBeanReference tbf = ( RuntimeBeanReference ) pvalue.getValue();                

                if ( kbase.equals( tbf.getBeanName() ) ) {

                    factory.addPropertyValue( "knowledgeAgent", new RuntimeBeanReference( beanName ) );

                }

            }          

        }       

 

        return factory.getBeanDefinition();

    }

 

 

it fails when ksession is stateful, because StatefulKnowledgeSessionBeanFactory don't have the property knowledgeAgent

 

I dont understand the propose of this part of code.

 

if you change the order definition from xml and define ksession at top, "it works" because how spring container load the beans, and is the reason of in the test cases of drools all works fine.

 

I tink that is a bug.

Reply to this message by going to Community

Start a new discussion in jBPM at Community