<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><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" target=_blank rel=nofollow>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>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>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>java.io</A>.ObjectInputStream.readNonProxyDesc(Unknown Source)<BR>at <A
 href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readClassDesc(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readArray(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readObject0(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.de/" target=_blank>java.io</A>.ObjectInputStream.defaultReadFields(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readSerialData(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readOrdinaryObject(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readObject0(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/"
 target=_blank>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>java.io</A>.ObjectStreamClass.invokeReadObject(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readSerialData(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readOrdinaryObject(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readObject0(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>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>java.io</A>.ObjectInputStream.readExternalData(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readOrdinaryObject(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>java.io</A>.ObjectInputStream.readObject0(Unknown Source)<BR>at <A href="http://java.io.objectinputstream.re/" target=_blank>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("File argument is null");<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("File does not exist");<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("")) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("RULE FILE ERRORS: " +<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><BR></FONT></DIV></DIV></div><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"> 
Find them fast with Yahoo! Search.</a></body></html>