Problem with KIE Scanner

372 views
Skip to first unread message

Zelimir Koljesar

unread,
Mar 20, 2015, 10:44:59 PM3/20/15
to drools...@googlegroups.com
We are using the latest version of Drools along with Camel and CXF. Initially we setup the project to deploy the drl files and compile them on startup. We would like to be able to pre-compile the drl files and load them via a jar file so the business would have the flexibility of changing the rules on the fly. I am having the hardest time getting this to work. I was finally able to build the jar file and use the kie:import to load it up. This seems to work, which is great. But as soon as I enable the scanner I get an error on startup. Here are the significant code/error snippets. I have done a ton of troubleshooting and I do not know if it's something I'm doing or if this is a bug within Drools.


<kie:import releaseId-ref="drools-rules" enableScanner="true" scannerInterval="10000"/>
<kie:releaseId id="drools-rules" groupId="com.company" artifactId="drools-rules" version="0.0.1-SNAPSHOT"/>


2015-03-20 22:21:07 ERROR ContextLoader:331 - Context initialization failed
java.lang.IllegalStateException: Could not register object [org.kie.scanner.KieRepositoryScannerImpl@587c7377] under bean name 'drools-rules-import#scanner': there is already object [org.kie.scanner.KieRepositoryScannerImpl@587c7377] bound
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.registerSingleton(DefaultSingletonBeanRegistry.java:129)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerSingleton(DefaultListableBeanFactory.java:821)
	at org.kie.spring.factorybeans.KieImportFactoryBean.registerKieBases(KieImportFactoryBean.java:129)
	at org.kie.spring.factorybeans.KieImportFactoryBean.postProcessBeanFactory(KieImportFactoryBean.java:108)
.
.
.
2015-03-20 22:21:07 WARN  XmlWebApplicationContext:883 - Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri Mar 20 22:20:53 EDT 2015]; root of context hierarchy
	at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
.
.
.
2015-03-20 22:21:07 WARN  XmlWebApplicationContext:891 - Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri Mar 20 22:20:53 EDT 2015]; root of context hierarchy
	at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359)

Mario Fusco

unread,
Mar 22, 2015, 2:50:33 PM3/22/15
to drools...@googlegroups.com

Hi,

I'd need to check what you're doing and try to debug your problem to figure out what's happening there. Could you please provide a small reproducer?

Thanks,
Mario

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/a2e7bc3e-5601-44f4-8bb2-8e997e15b61e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zelimir Koljesar

unread,
Mar 23, 2015, 12:23:34 PM3/23/15
to drools...@googlegroups.com
It would take me a little while to scrub the company code and provide only what's necessary. Basically the import of the external kjar with the scanner option enabled is not working for me. Does this feature work without any issues today? I've done everything that was needed according to the docs:

Zelimir Koljesar

unread,
Mar 25, 2015, 10:02:47 AM3/25/15
to drools...@googlegroups.com
Mario I will provide a sample war file as soon as I can. Would love for someone to take a look. 


On Sunday, March 22, 2015 at 2:50:33 PM UTC-4, Mario Fusco wrote:

Dragos Dumitrescu

unread,
Jul 3, 2015, 9:08:00 AM7/3/15
to drools...@googlegroups.com
I am facing the same problem. Did you find any viable solution?

Dragos Dumitrescu

unread,
Jul 3, 2015, 11:45:32 AM7/3/15
to drools...@googlegroups.com
I have figured out a workaround for this issue by overriding the default KieSpringNamespaceHandler, then the KieImportDefinitionParser, then the KieImportFactoryBean such  that the method registerKieBases(ConfigurableListableBeanFactory configurableListableBeanFactory) calls 

configurableListableBeanFactory.registerSingleton(releaseIdName + "#scanner", kieScanner);

only at the beggining of the method and not in the for loop.

Zelimir Koljesar

unread,
Jul 6, 2015, 10:18:11 AM7/6/15
to drools...@googlegroups.com
Thank you for responding to my post! So looks like there is a way to make this work.  :)   For now we seem to be ok with redeploying our app, but maybe down the road we may have to utilize the "scanner". I am glad you got it working!
Reply all
Reply to author
Forward
0 new messages