Try to add all the packages to a kbuilder and then serialize the resulting packages. You will need to create a PKG per logical package though. If your DSLR and DSL files are in the same logical package, the kbuilder will only contain one package that you have to serialize.


Best, 



XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Thu, Aug 5, 2010 at 12:08 PM, jrob <josh.roberts@cerner.com> wrote:

After further testing, here's what I am seeing.

GOAL: Serialize a KnowledgePackage object (or Collection of them) to a File,
read that file in as a PKG to create a KnowledgeBase

I have not gotten basic Java Serialization to work. I get the exception from
the previous post every time I try to create the KnowledgeAgent/Builder
using the PKG file.

When using the DroolsStreamUtils class to do the serialization, the only way
I get it to work is when I serialize a SINGLE KnowledgePackage (Collection
doesn't work, this also limits to using a single resource, so building a PKG
manually to represent a DSL + DSLR won't work) and use a KnowledgeAgent
(with a changeset.xml that references the single PKG file). When I try to
use Collections of KnowledgePackages (with KnowledgeBuilder or
KnowledgeAgent), I get a classcastexception only this time it recognizes it
as an ArrayList. When I try to use the single package with a
KnowledgeBuilder, I get a classcastexception to KnowledgePackageImp.

After seeing in the code for Package.readExternal() (which is executed as
soon as the resource trying to be added is of type 'PKG' is:

this.dialectRuntimeRegistry = (DialectRuntimeRegistry) in.readObject()

I am assuming it is not possible to truly create your own PKG resources
unless you want to create a PKG per resource, is this correct?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl-tp694012p1026584.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users