&nbsp;<br>&nbsp;&nbsp; Why don&#39;t you use DroolsObjectInputStream to deserialize it? Check the integration tests on how to do it.<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2007/12/6, Manan Gosalia &lt;<a href="mailto:goldenmask13@yahoo.com">
goldenmask13@yahoo.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: courier,monaco,monospace,sans-serif; font-size: 10pt;">
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div>Hello,</div>
<div>&nbsp;</div>
<div>I am trying to deserialize rule package from disk. However, I am getting the following exception. I have also included the code that I use to deserialize rule packages. I found only one link on the web that describes this issue after looking around: 
<a href="http://www.mail-archive.com/user@drools.codehaus.org/msg01731.html" rel="nofollow" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.mail-archive.com/user@drools.codehaus.org/msg01731.html
</a>. But there was no solution or help there. Any idea?</div>
<div>&nbsp;</div>
<div>I am using drools 3.0.5 and Java 1.5.</div>
<div>&nbsp;</div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">Caused by: java.lang.ClassNotFoundException: [Lorg.drools.rule.Declaration;<br>at <a href="http://java.net/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.net</a>.URLClassLoader$1.run(Unknown Source)<br>at java.security.AccessController.doPrivileged(Native Method)<br>at <a href="http://java.net.urlclassloader.fi/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.net</a>.URLClassLoader.findClass(Unknown Source)<br>at java.lang.ClassLoader.loadClass(Unknown Source)<br>at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)<br>at java.lang.ClassLoader.loadClass(Unknown Source)
<br>at org.drools.rule.PackageCompilationData$PackageClassLoader.loadClass(Unknown Source)<br>at java.lang.ClassLoader.loadClass(Unknown Source)<br>at org.drools.common.ObjectInputStreamWithLoader.resolveClass(Unknown Source)
<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readNonProxyDesc(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.readClassDesc(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readArray(Unknown Source)
<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readObject0(Unknown Source)<br>at <a href="http://java.io.objectinputstream.de/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.defaultReadFields(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readSerialData(Unknown Source)
<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readOrdinaryObject(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.readObject0(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readObject(Unknown Source)
<br>at java.util.HashMap.readObject(Unknown Source)<br>at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)<br>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br>at java.lang.reflect.Method.invoke
(Unknown Source)<br>at <a href="http://java.io.objectstreamclass.in/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectStreamClass.invokeReadObject(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.readSerialData(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readOrdinaryObject(Unknown Source)
<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readObject0(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.readObject(Unknown Source)<br>at
 org.drools.rule.PackageCompilationData.readExternal(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readExternalData(Unknown Source)
<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readOrdinaryObject(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
java.io</a>.ObjectInputStream.readObject0(Unknown Source)<br>at <a href="http://java.io.objectinputstream.re/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">java.io</a>.ObjectInputStream.readObject(Unknown Source)
<br>at org.drools.rule.Package.readExternal(Unknown Source)<br>at com.cisco.cp.engine.util.CPRuleUtil$CPRuleFileHelper.getRulePackage(CPRuleUtil.java:654)<br>... 26 more</font></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">private Package getRulePackage(File file) throws Exception {<br>&nbsp;&nbsp;&nbsp; // Make sure file is a valid rule file with the proper rule file<br>&nbsp;&nbsp;&nbsp; // ... type.<br>
&nbsp;&nbsp;&nbsp; if(file == null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new Exception(&quot;File argument is null&quot;);<br>&nbsp;&nbsp;&nbsp; }</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp; if(!file.exists()) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new Exception(&quot;File does not exist&quot;);<br>&nbsp;&nbsp;&nbsp; }</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"></font>&nbsp;</div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp; FileInputStream ruleFileInputStream = null;<br>&nbsp;&nbsp;&nbsp; ObjectInputStream ruleObjectInputStream = null;<br>&nbsp;&nbsp;&nbsp; Reader ruleFileReader = null;<br>&nbsp;&nbsp;&nbsp; Package rulePackage = null;
</font></div>
<div><font face="Courier" size="2"></font>&nbsp;</div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rulePackage = new Package();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // If the rule file is already compiled, then we just have<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ... read it through object input stream.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ruleFileInputStream = new FileInputStream(file);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ruleObjectInputStream =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new ObjectInputStream(ruleFileInputStream);</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rulePackage.readExternal(ruleObjectInputStream);<br></font><font face="courier, monaco, monospace, sans-serif" size="2"></font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Validate the package - this will throw exception if there<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ... were any error in the package.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rulePackage.checkValidity
();</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp; }<br></font><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp;&nbsp;&nbsp; finally {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rulePackage != null &amp;&amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
rulePackage.getErrorSummary() != null &amp;&amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; !rulePackage.getErrorSummary().equals(&quot;&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;RULE FILE ERRORS: &quot; +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rulePackage.getErrorSummary
());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ruleObjectInputStream != null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 ruleObjectInputStream.close();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ruleFileInputStream != null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ruleFileInputStream.close();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ruleFileReader != null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ruleFileReader.close
();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">&nbsp; &nbsp;&nbsp;return rulePackage;<br>}<br><span class="ad"><br></span></font></div></div></div><span class="ad"><br>
      <hr size="1">Looking for last minute shopping deals? <a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
 
Find them fast with Yahoo! Search.</a></span></div><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;JBoss Drools Core Development<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>