Are you experiencing any error? Or it just doesn't work as you expected?
Try doing a test without using kagent. Try to create a new KBase and add the
serialized packages you have.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
http://www.plugtree.com
- Blog @
http://ilesteban.wordpress.com
On Wed, Aug 4, 2010 at 1:07 PM, jrob <josh.roberts(a)cerner.com> wrote:
Did you actually get this to work? I have tried both ways to create a .PKG
mentioned here and still haven't got it to work.
FILE CREATION CODE (Commented out portions are for direct serialization):
public static void createPKG(Collection<KnowledgePackage> kpkgs,
File file)
throws IOException, FileNotFoundException
{
FileOutputStream fos = null;
ObjectOutputStream out = null;
fos = new FileOutputStream(file);
out = new ObjectOutputStream(fos);
try
{
//out.writeObject(kpkgs);
DroolsStreamUtils.streamOut(fos, kpkgs);
}
catch (IOException e)
{
String error ="Could not serialize object!";
logger.error(error);
throw new DroolsPKGCreatorException(error,e);
}
finally
{
try
{
//out.close();
fos.close();
}
catch (IOException e)
{
logger.error("Could not close stream during
serialization!",e);
}
}
}
KBASE CREATION FROM PKG
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent(
"MyKnowledgeAgent" );
kagent.applyChangeSet(ResourceFactory.newClassPathResource(/* file created
from above method */));
KnowledgeBase kbase = kagent.getKnowledgeBase();
Am I doing something wrong? Thanks for the help!
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users