I'm trying to run drools 6.2.0.Final with Spring Boot 1.2.2.RELEASE. I configured drools as the documentation says. My kie-context.xml configuration file is where I keep the drools beans and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:kie="http://drools.org/schema/kie-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd">
<kie:kmodule id="sample_module">
<kie:kbase name="kbase1" packages="composition-rules">
<kie:ksession name="ksession1" type="stateless"/>
</kie:kbase>
</kie:kmodule>
<bean id="kiePostProcessor" class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>
as i try to compile the application and run with spring-boot i get the following error:
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6ab6cc3b: startup date [Wed Apr 15 13:57:02 CEST 2015]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:877)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:150)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:342)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at skeleton.StorfinoApplication.main(StorfinoApplication.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Unable to get all ZipFile entries: /home/lukasz/dev/skeleton/application/target/application-1.0-SNAPSHOT.jar!
at org.drools.core.util.IoUtils.indexZipFile(IoUtils.java:133)
at org.drools.compiler.kie.builder.impl.ZipKieModule.<init>(ZipKieModule.java:20)
at org.drools.compiler.kie.builder.impl.ClasspathKieProject.createInternalKieModule(ClasspathKieProject.java:186)
at org.kie.spring.KModuleBeanFactoryPostProcessor.createKieModule(KModuleBeanFactoryPostProcessor.java:189)
at org.kie.spring.KModuleBeanFactoryPostProcessor.addKieModuleToRepo(KModuleBeanFactoryPostProcessor.java:162)
at org.kie.spring.KModuleBeanFactoryPostProcessor.postProcessBeanFactory(KModuleBeanFactoryPostProcessor.java:121)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at skeleton.StorfinoApplication.main(StorfinoApplication.java:23)
... 6 more
Caused by: java.io.FileNotFoundException: /home/user-name/dev/skeleton/application/target/application-1.0-SNAPSHOT.jar! (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at org.drools.core.util.IoUtils.indexZipFile(IoUtils.java:124)
... 21 more
The command I used for building the project is:
mvn clean package
and i run it as a jar file (java -jar application/target/application-1.0-SNAPSHOT.jar
).
A thing that caught my attention is that the file path (the one which is not found) has an exclamation mark at the end (it is not supposed to be here). The other thing that i observed is that when i run the project in IntelijIdea ide it succeeds to build and works properly.
What could be the reason of such error?