<br> Why don't you use DroolsObjectInputStream to deserialize it? Check the integration tests on how to do it.<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/12/6, Manan Gosalia <<a href="mailto:goldenmask13@yahoo.com">
goldenmask13@yahoo.com</a>>:</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> </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> </div>
<div>I am using drools 3.0.5 and Java 1.5.</div>
<div> </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> </div>
<div> </div>
<div> </div>
<div><font face="courier, monaco, monospace, sans-serif" size="2">private Package getRulePackage(File file) throws Exception {<br> // Make sure file is a valid rule file with the proper rule file<br> // ... type.<br>
if(file == null) {<br> throw new Exception("File argument is null");<br> }</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> if(!file.exists()) {<br> throw new Exception("File does not exist");<br> }</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"></font> </div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> FileInputStream ruleFileInputStream = null;<br> ObjectInputStream ruleObjectInputStream = null;<br> Reader ruleFileReader = null;<br> Package rulePackage = null;
</font></div>
<div><font face="Courier" size="2"></font> </div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> try {<br> rulePackage = new Package();<br> // If the rule file is already compiled, then we just have<br> // ... read it through object input stream.
<br> ruleFileInputStream = new FileInputStream(file);<br> ruleObjectInputStream =<br> new ObjectInputStream(ruleFileInputStream);</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> 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"> // Validate the package - this will throw exception if there<br> // ... were any error in the package.<br> rulePackage.checkValidity
();</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> }<br></font><font face="courier, monaco, monospace, sans-serif" size="2"> finally {<br> if (rulePackage != null &&<br>
rulePackage.getErrorSummary() != null &&<br> !rulePackage.getErrorSummary().equals("")) {<br> System.out.println("RULE FILE ERRORS: " +<br> rulePackage.getErrorSummary
());<br> }<br> if (ruleObjectInputStream != null) {<br>
ruleObjectInputStream.close();<br> }<br> if (ruleFileInputStream != null) {<br> ruleFileInputStream.close();<br> }<br> if (ruleFileReader != null) {<br> ruleFileReader.close
();<br> }<br> }</font></div>
<div><font face="courier, monaco, monospace, sans-serif" size="2"> 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> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>