Hey,
I was trying to read a package(ResourceType.PKG), which i downloaded from
Guvnor, using KnowledgeBuilder, but I consistently get the following error
while trying to access the file.
Here's my code and the error,
**Code**
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClassPathResource( "Goal Creation
Charges.pkg", getClass() ), ResourceType.PKG );
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
**Error**
java.lang.RuntimeException: java.io.StreamCorruptedException: invalid stream
header: 7061636B
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:724)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
at
com.infosys.fps.drools.adapter.DroolsAdapter.readKnowledgeBase(DroolsAdapter.java:80)
at com.infosys.fps.drools.adapter.DroolsAdapter.main(DroolsAdapter.java:20)
Caused by: java.io.StreamCorruptedException: invalid stream header: 7061636B
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at
org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStream.java:68)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:205)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)
at
org.drools.compiler.PackageBuilder.addPackageFromInputStream(PackageBuilder.java:819)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:711)
... 4 more
I have tried using both binary and source from guvnor, but neither of them
works. I get the same error. Is there something m doing wrong ?
Thanks,
Abhinay
--
View this message in context:
http://drools.46999.n3.nabble.com/Reading-a-Guvnor-PKG-from-drools-API-tp...
Sent from the Drools: User forum mailing list archive at
Nabble.com.