Hello
I'm getting an exception when adding a Collection<KnowledgePackage> after
read it from a file with readObject()
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at
org.drools.base.ClassObjectType.isAssignableFrom(ClassObjectType.java:180)
at
org.drools.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:95)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java:80)
at
org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:112)
at
org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:70)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:161)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:134)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:113)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:445)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:952)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:629)
*at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)*
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:149)
at
andanta.conversacion.DroolsEmpresa.readKnowledgeBaseFromMemoryFile(DroolsEmpresa.java:304)
at
andanta.comunicacion.ServidorMR.cargaInfoConocimiento(ServidorMR.java:483)
at andanta.test.Tester.main(Tester.java:127)
The code for serialize the object is
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream(
fileName ) );
out.writeObject( kbuilder.getKnowledgePackages());
out.close();
And the code for deserialize is
ObjectInputStream in = new ObjectInputStream( new FileInputStream(
fileName) );
Collection<KnowledgePackage> kpkgs =
(Collection<KnowledgePackage>)in.readObject();
in.close();
kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kpkgs );
My environment is eclipse 3.7, java 7.0.21 y drools 5.5.0.
I thought this error may be due to a rule, but if I run
kbase.addKnowledgePackages after reading the rules from drl file, there will
be no exception.
Best Regards.
--
View this message in context:
http://drools.46999.n3.nabble.com/Error-deserializing-Knowledge-Package-i...
Sent from the Drools: User forum mailing list archive at
Nabble.com.