<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>I am facing a tough 
problem requiring some abnormal solutions: The requirements calls for million 
rules (they all think about that at the beginning), so we are thinking about 
packaging rules on the fly during execution instead caching all the rules in the 
rules engine.&nbsp; All the rules will be pre-compiled and serialized to 
storage.&nbsp; We would like to achieve to separate the Package and Rule's 
objects, and dynamically compose the Package object when 
needed.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>I tried the 
following steps and was enable to move forward beyond step 
5:</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>1.&nbsp; Create the 
Package object by using 
PackageBuilder().addPackageFromDrl(drl_file).</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>2.&nbsp; For each 
rule under the Package object, remove it from Package by calling 
Package().removeRule(rule), then serialize it to storage.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>3.&nbsp; Serialize 
the now empty Package object to storage.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>&lt;!-- when 
recompose the Package object, perform the following steps 
--&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>4.&nbsp; Deserialize 
the Package.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>5.&nbsp; Deserialize 
the Rule objects - this is where I encountered an ClassNotFoundException at the 
end of the message</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>6.&nbsp; Using 
Package().addRule(rule) to add needed rules - not tried yet.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>7.&nbsp; Add the 
package to RuleBase..... as normally do.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial 
size=2>java.lang.ClassNotFoundException: 
com.travelocity.rules.hotel.Rule_Match_Region_Rule_1_0ConsequenceInvoker<BR>&nbsp;at 
java.net.URLClassLoader$1.run(URLClassLoader.java:200)<BR>&nbsp;at 
java.security.AccessController.doPrivileged(Native Method)<BR>&nbsp;at 
java.net.URLClassLoader.findClass(URLClassLoader.java:188)<BR>&nbsp;at 
java.lang.ClassLoader.loadClass(ClassLoader.java:306)<BR>&nbsp;at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)<BR>&nbsp;at 
java.lang.ClassLoader.loadClass(ClassLoader.java:251)<BR>&nbsp;at 
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)<BR>&nbsp;at 
java.lang.Class.forName0(Native Method)<BR>&nbsp;at 
java.lang.Class.forName(Class.java:242)<BR>&nbsp;at 
java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:585)<BR>&nbsp;at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)<BR>&nbsp;at 
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)<BR>&nbsp;at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)<BR>&nbsp;at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)<BR>&nbsp;at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)<BR>&nbsp;at 
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)<BR>&nbsp;at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)<BR>&nbsp;at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)<BR>&nbsp;at 
java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)<BR>&nbsp;at 
com.travelocity.common.util.IOUtil.readObject(IOUtil.java:158)<BR>&nbsp;at 
com.travelocity.common.util.IOUtil.readObject(IOUtil.java:147)<BR>&nbsp;at 
com.travelocity.rules.hotel.HotelChargeRulesUnitTest.loadPackage(HotelChargeRulesUnitTest.java:64)<BR>&nbsp;at 
com.travelocity.rules.hotel.HotelChargeRulesUnitTest.testHotelChargeRequest(HotelChargeRulesUnitTest.java:41)<BR>&nbsp;at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<BR>&nbsp;at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<BR>&nbsp;at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<BR>&nbsp;at 
com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>In the application, 
the rule name is "Match Region Rule 1", and the package name is 
"com.travelocity.rules.hotel".&nbsp; Please advise if it is possible to get 
around this problem, or if this approach would really work?</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>Your help is greatly 
appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial 
size=2>-Ming</FONT></SPAN></DIV></BODY></HTML>