Hi all,
I'm trying to use the resource scanner in my application (drools 5.1.1,
also tried in 5.2.0-SNAPSHOT):
--snip--
//resource scanner
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet(
ResourceFactory.newByteArrayResource(this.getChangeConfiguration()) );
KnowledgeBase kbase = kagent.getKnowledgeBase();
this.ksession = kbase.newStatefulKnowledgeSession();
--snip--
and getting always a 'KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage' (see stacktrace below). Of
course I've googled for the problem and found that it was in 5.0.1 a
incompatibility problem between drools expert and guvner. But I'm not
using guvnor at all. I want to place some *.drl files in a directory and
run an agent that automatically updates my knowledge base. The agent
finds the directory and the files, but has problems to deserialize them.
If I'm loading them directly into the knowledge base they will work fine.
Any hints to find a solution are welcome.
Best regards - Claus
-----
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:732)
at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:965)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:774)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:646)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:172)
at
com.catify.core.process.routers.DecisionRouter.<init>(DecisionRouter.java:32)
at
com.catify.core.rest.TestDecisionRouter.testRouting(TestDecisionRouter.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.io.StreamCorruptedException: invalid stream header: 7061636B
at
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:800)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:297)
at
org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStream.java:71)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:205)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:174)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:721)
... 27 more