I am facing this error of knowledgeagent trying to deserialize knowledgedefinitionspackage. Actually I am not too sure what caused this problem..
I have successfully deployed my rules in guvnor, and running a sample test case on one of the ruleflow works fine. However, when I tried to integrate into an existing project, using the same code of initializing knowledgeagent from the sample test, the error occurred. I am using drools 5.1.0.m1. Below is the error messages..
jvm 1 | WorkManager(2)-4 11:35:59,312 INFO [STDOUT line:152] [2010:02:35 11:02:312:info] ResourceChangeScanner creat
ed with default interval=60
jvm 1 | WorkManager(2)-4 11:35:59,312 INFO [STDOUT line:152] [2010:02:35 11:02:312:info] ResourceChangeScanner recon
figured with interval=15
jvm 1 | WorkManager(2)-4 11:35:59,531 INFO [STDOUT line:152] [2010:02:35 11:02:531:info] ResourceChangeNotification
created
jvm 1 | WorkManager(2)-4 11:35:59,531 INFO [STDOUT line:152] [2010:02:35 11:02:531:debug] ResourceChangeNotification
monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@160498d
jvm 1 | WorkManager(2)-4 11:35:59,531 INFO [STDOUT line:152] [2010:02:35 11:02:531:info] KnowledgAgent created, with
configuration:
jvm 1 | monitorChangeSetEvents=true scanResources=true scanDirectories=true
jvm 1 | Thread-17 11:35:59,531 INFO [STDOUT line:152] [2010:02:35 11:02:531:info] KnowledegAgent has started listeni
ng for ChangeSet notifications
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] (null: 3, 92): schema_reference.4: Failed to read schem
a document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) th
e root element of the document is not <xsd:schema>.
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] (null: 3, 92): cvc-elt.1: Cannot find the declaration o
f element 'change-set'.
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] (null: 4, 10): schema_reference.4: Failed to read schem
a document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) th
e root element of the document is not <xsd:schema>.
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] (null: 5, 132): schema_reference.4: Failed to read sche
ma document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) t
he root element of the document is not <xsd:schema>.
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:info] KnowledgAgent applying Chan
geSet
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] KnowledgeAgent subscribing
to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/myPackage/LATES
T']
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] ResourceChangeNotification
subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@a0fdd1 to resource=[UrlResource path='http://localhost:80
80/drools-guvnor/org.drools.guvnor.Guvnor/package/myPackage/LATEST']
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] ResourceChangeScanner subc
ribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@615dc4 to resource=[UrlResource path='http://localhost:808
0/drools-guvnor/org.drools.guvnor.Guvnor/package/myPackage/LATEST']
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] KnowledgeAgent ChangeSet r
equires KnowledgeBuilder
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] KnowledgeAgent rebuilding
KnowledgeBase using ChangeSet
jvm 1 | WorkManager(2)-4 11:35:59,609 INFO [STDOUT line:152] [2010:02:35 11:02:609:debug] KnowledgeAgent building re
source=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/myPackage/LATEST']
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] [2010:02:35 11:02:843:exception]
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] java.lang.RuntimeException: KnowledgeAgent exception wh
ile trying to deserialize KnowledgeDefinitionsPackage
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.drools.agent.impl.KnowledgeAgentImpl.rebu
ildResources(KnowledgeAgentImpl.java:418)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.drools.agent.impl.KnowledgeAgentImpl.appl
yChangeSet(KnowledgeAgentImpl.java:120)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.drools.agent.impl.KnowledgeAgentImpl.appl
yChangeSet(KnowledgeAgentImpl.java:109)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.dsta.smart.util.DroolsRuleEngine.init(Dro
olsRuleEngine.java:48)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.dsta.smart.util.DroolsRuleEngine.<init>(D
roolsRuleEngine.java:24)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.dsta.smart.util.RuleEngineManager.init(Ru
leEngineManager.java:28)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.dsta.smart.util.RuleEngineManager.getInst
ance(RuleEngineManager.java:20)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.dsta.smart.mdb.FilterAnomaliesIndicatorMD
B.onMessage(FilterAnomaliesIndicatorMDB.java:118)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at sun.reflect.NativeMethodAccessorImpl.invoke(N
ativeMethodAccessorImpl.java:39)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at java.lang.reflect.Method.invoke(Method.java:5
85)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:112)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.interceptor.InvocationContextI
mpl.proceed(InvocationContextImpl.java:166)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.interceptor.EJB3InterceptorsIn
terceptor.invoke(EJB3InterceptorsInterceptor.java:63)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:101)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.entity.TransactionScopedEntity
ManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:101)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.AllowedOperationsInterceptor.i
nvoke(AllowedOperationsInterceptor.java:47)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:101)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aspects.tx.TxPolicy.invokeInCallerT
x(TxPolicy.java:126)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aspects.tx.TxInterceptor$Required.i
nvoke(TxInterceptor.java:195)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:101)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.stateless.StatelessInstanceInt
erceptor.invoke(StatelessInstanceInterceptor.java:62)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.aop.joinpoint.MethodInvocation.invo
keNext(MethodInvocation.java:101)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.mdb.MessagingContainer.localIn
voke(MessagingContainer.java:249)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.mdb.inflow.MessageInflowLocalP
roxy.delivery(MessageInflowLocalProxy.java:268)
jvm 1 | WorkManager(2)-4 11:35:59,843 INFO [STDOUT line:152] at org.jboss.ejb3.mdb.inflow.MessageInflowLocalP
roxy.invoke(MessageInflowLocalProxy.java:138)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at $Proxy119.onMessage(Unknown Source)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.resource.adapter.jms.inflow.JmsServ
erSession.onMessage(JmsServerSession.java:178)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.mq.SpyMessageConsumer.sessionConsum
erProcessMessage(SpyMessageConsumer.java:906)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.mq.SpyMessageConsumer.addMessage(Sp
yMessageConsumer.java:170)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.mq.SpySession.run(SpySession.java:3
23)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.resource.adapter.jms.inflow.JmsServ
erSession.run(JmsServerSession.java:237)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.resource.work.WorkWrapper.execute(W
orkWrapper.java:204)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at org.jboss.util.threadpool.BasicTaskWrapper.ru
n(BasicTaskWrapper.java:275)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at EDU.oswego.cs.dl.util.concurrent.PooledExecut
or$Worker.run(PooledExecutor.java:756)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.lang.Thread.run(Thread.java:595)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] Caused by: java.io.InvalidClassException: org.drools.ba
se.ClassFieldAccessorStore; local class incompatible: stream classdesc serialVersionUID = 400, local class serialVersion
UID = 487535245723988666
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectStreamClass.initNonProxy(Object
StreamClass.java:546)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readNonProxyDesc(Ob
jectInputStream.java:1552)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readClassDesc(Objec
tInputStream.java:1466)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1699)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readObject0(ObjectI
nputStream.java:1305)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.skipCustomData(Obje
ctInputStream.java:1873)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readExternalData(Ob
jectInputStream.java:1767)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1717)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readObject0(ObjectI
nputStream.java:1305)
jvm 1 | WorkManager(2)-4 11:35:59,921 INFO [STDOUT line:152] at java.io.ObjectInputStream.readObject(ObjectIn
putStream.java:348)
jvm 1 | WorkManager(2)-4 11:35:59,937 INFO [STDOUT line:152] at org.drools.util.DroolsStreamUtils.streamIn(Dr
oolsStreamUtils.java:189)
jvm 1 | WorkManager(2)-4 11:35:59,937 INFO [STDOUT line:152] at org.drools.util.DroolsStreamUtils.streamIn(Dr
oolsStreamUtils.java:158)
jvm 1 | WorkManager(2)-4 11:35:59,937 INFO [STDOUT line:152] at org.drools.agent.impl.KnowledgeAgentImpl.rebu
ildResources(KnowledgeAgentImpl.java:408)
jvm 1 | WorkManager(2)-4 11:35:59,937 INFO [STDOUT line:152] ... 37 more
jvm 1 | WorkManager(2)-4 11:35:59,937 INFO [STDOUT line:152] [2010:02:35 11:02:937:info] KnowledgeAgent new Knowledg
eBase now built and in use
jvm 1 | Thread-18 11:35:59,937 INFO [STDOUT line:152] [2010:02:35 11:02:937:info] ResourceChangeNotification has sta
rted listening for ChangeSet publications
jvm 1 | Thread-18 11:35:59,937 INFO [STDOUT line:152] [2010:02:35 11:02:937:debug] ResourceChangeNotification thread
is waiting for queue update
jvm 1 | Thread-19 11:35:59,937 INFO [STDOUT line:152] [2010:02:35 11:02:937:info] ResourceChangeNotification scanner
has started
jvm 1 | Thread-19 11:35:59,937 INFO [STDOUT line:152] [2010:02:35 11:02:937:debug] ResourceChangeScanner attempt to
scan 1 resources
jvm 1 | Thread-19 11:35:59,953 INFO [STDOUT line:152] [2010:02:35 11:02:953:debug] ResourceChangeScanner thread is w
aiting for 15
And this are the codes I used to init drools..
ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty( "drools.resource.scanner.interval", "15" );
ResourceFactory.getResourceChangeScannerService().configure( sconf );
KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories", "true" );
kaconf.setProperty( "drools.agent.scanResources", "true" );
kaconf.setProperty( "drools.agent.newAgent", "true" );
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent", kaconf );
kagent.applyChangeSet(ResourceFactory.newUrlResource(new URL("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/myPackage/LATEST/ChangeSet.xml")));
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
KnowledgeBase kbase = kagent.getKnowledgeBase();
ksession = kbase.newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
Anyone helps??