<!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. All the rules will be pre-compiled and serialized to
storage. 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> </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. Create the
Package object by using
PackageBuilder().addPackageFromDrl(drl_file).</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>2. 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. Serialize
the now empty Package object to storage.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2><!-- when
recompose the Package object, perform the following steps
--></FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>4. Deserialize
the Package.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial size=2>5. 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. 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. Add the
package to RuleBase..... as normally do.</FONT></SPAN></DIV>
<DIV><SPAN class=109292116-31072007><FONT face=Arial
size=2></FONT></SPAN> </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> at
java.net.URLClassLoader$1.run(URLClassLoader.java:200)<BR> at
java.security.AccessController.doPrivileged(Native Method)<BR> at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)<BR> at
java.lang.ClassLoader.loadClass(ClassLoader.java:306)<BR> at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)<BR> at
java.lang.ClassLoader.loadClass(ClassLoader.java:251)<BR> at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)<BR> at
java.lang.Class.forName0(Native Method)<BR> at
java.lang.Class.forName(Class.java:242)<BR> at
java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:585)<BR> at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)<BR> at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)<BR> at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)<BR> at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)<BR> at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)<BR> at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)<BR> at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)<BR> at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)<BR> at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)<BR> at
com.travelocity.common.util.IOUtil.readObject(IOUtil.java:158)<BR> at
com.travelocity.common.util.IOUtil.readObject(IOUtil.java:147)<BR> at
com.travelocity.rules.hotel.HotelChargeRulesUnitTest.loadPackage(HotelChargeRulesUnitTest.java:64)<BR> at
com.travelocity.rules.hotel.HotelChargeRulesUnitTest.testHotelChargeRequest(HotelChargeRulesUnitTest.java:41)<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<BR> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<BR> at
com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </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". 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> </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>