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.<div>

<br></div><div><br></div><div>Best, </div><div><br></div><div><br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>

- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Thu, Aug 5, 2010 at 12:08 PM, jrob <span dir="ltr">&lt;<a href="mailto:josh.roberts@cerner.com">josh.roberts@cerner.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
After further testing, here&#39;s what I am seeing.<br>
<br>
GOAL: Serialize a KnowledgePackage object (or Collection of them) to a File,<br>
read that file in as a PKG to create a KnowledgeBase<br>
<br>
I have not gotten basic Java Serialization to work. I get the exception from<br>
the previous post every time I try to create the KnowledgeAgent/Builder<br>
using the PKG file.<br>
<br>
When using the DroolsStreamUtils class to do the serialization, the only way<br>
I get it to work is when I serialize a SINGLE KnowledgePackage (Collection<br>
doesn&#39;t work, this also limits to using a single resource, so building a PKG<br>
manually to represent a DSL + DSLR won&#39;t work) and use a KnowledgeAgent<br>
(with a changeset.xml that references the single PKG file). When I try to<br>
use Collections of KnowledgePackages (with KnowledgeBuilder or<br>
KnowledgeAgent), I get a classcastexception only this time it recognizes it<br>
as an ArrayList. When I try to use the single package with a<br>
KnowledgeBuilder, I get a classcastexception to KnowledgePackageImp.<br>
<br>
After seeing in the code for Package.readExternal() (which is executed as<br>
soon as the resource trying to be added is of type &#39;PKG&#39; is:<br>
<br>
this.dialectRuntimeRegistry = (DialectRuntimeRegistry) in.readObject()<br>
<br>
I am assuming it is not possible to truly create your own PKG resources<br>
unless you want to create a PKG per resource, is this correct?<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl-tp694012p1026584.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl-tp694012p1026584.html</a><br>


</font><div><div></div><div class="h5">Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>