It is a bit dated now (we're on 5.0.1) but this works on that release:
FileOutputStream fos = new
FileOutputStream(drlcFile);
ObjectOutputStream oos = new
ObjectOutputStream(fos);
oos.writeObject(pkg);
oos.close();
Joe
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of lhorton
Sent: Thursday, June 16, 2011 10:28 AM
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
I revised my method to write a single package and to use the Drools
stream
classes:
KnowledgePackage pkg = packages.iterator().next();
DroolsObjectOutputStream out;
try {
out = new DroolsObjectOutputStream(new
FileOutputStream(outFilePath));
DroolsStreamUtils.streamOut(out, pkg,
Boolean.TRUE);
out.close();
} catch (IOException ex) {
logger.debug(ex.getMessage());
}
I tested this with the compression option and without, but knowledge
agent
still cannot deserialize. I now get exception:
Caused by: java.io.OptionalDataException
at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1339)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:2
05)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:1
74)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(Knowl
edgeAgentImpl.java:653)
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-KnowledgeAgent-exception-w
hile-trying-to-deserialize-KnowledgeDefinitionsPackage-tp3064043p3072696
.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users