You should be able to serialise a Package without having to first add it to PackageBuilder, we have numerous tests for this.
Mark, I looked at the test in PackageBuilderTest.testSerializable(), but it is too syntetic, f.e. it doesn’t
use insert(…) function as I do in my scenario. Please try creating a test
with inserting some MyClass() after deserializing without recreating
PackageBuilder and you will see it failing. I made many tests suggesting that.
Even when I use DroolsObjectInputStream()
-Sergey
From: rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Mark Proctor
Sent: Tuesday, October 09, 2007
6:25 PM
To: Rules Users List
Subject: Re: [rules-users] RE: RE:
rules precompilation
Manukyan, Sergey wrote:
Ekke, Thanks a lot! It worked just fine... The other missing point is that after deserializing the PackageBuildershould be buit as in your example : builder = new PackageBuilder((Package)ois.readObject()); and later on from that isnatcne should be retrieved the Package inctanceby doing: package = buider.getPackage(); as otherwise this code was failing: package = (Package)ois.readObject(); // FAILES, subsequent useof package produces "class not found" exception when inserting objects. Mark, Think this should be documented somewhere in manual... under IMPORTANTsection... by the way, IMHO that section should be more visible fromwhat is used currently in manual... - thin italic font, how about boldred?
You should be able to serialise a Package without
having to first add it to PackageBuilder, we have numerous tests for
this.
Thanks to all, -Sergey -----Original Message-----From: rules-users-bounces@lists.jboss.org[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of ekkeSent: Tuesday, October 09, 2007 2:35 PMTo: rules-users@lists.jboss.orgSubject: [rules-users] RE: RE: rules precompilation Sergey, of course Mark is right - you shouldn't use readExternal and the defaultconstructor.this was my fault from an earlier mail. please try something like this: // EXPORT...FileOutputStream fos ........ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(fos); oos.writeObject(builder.getPackage()); oos.close(); } catch (final IOException e) { ... your code.... }... // IMPORTFileInputStream fis......ObjectInputStream ois = null; try { ois = new ObjectInputStream(fis); builder = newPackageBuilder((Package)ois.readObject()); ois.close(); } catch (final IOException e) { ...your code...; } catch (final ClassNotFoundException e) { ...your code...; } now your imported package should work like the exported ekke Manukyan, Sergey wrote:
Ekke,Started using 4.0.2, but getting same error.This is how I am loading the Package :this.pkg = new Package();this.pkg.readExternal(ois);Does that look right to you?-Sergey-----Original Message-----From: rules-users-bounces@lists.jboss.org[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of ekkeSent: Wednesday, October 03, 2007 4:08 PMTo: rules-users@lists.jboss.orgSubject: [rules-users] RE: rules precompilationsergey,just tried it:exported a package with rules as stream(using the writeExternal() from Package)then in another run I created new RuleBase, added new Package,then import the rules into this empty Package (using the
readExternal()
fromPackage)then added some facts, execute the rules,tested if all rules are there,tested if the Facts are in workingMemory - all ok(using snapshot 4.0.2, eclipse 3.3, osx 10.4.10)ekkeManukyan, Sergey wrote:Ming, Ekke,After deserialising the Package back - getting exception wheninsertingfacts:Exception thrown : java.lang.NoClassDefFoundError: XXXShadowProxyXXX - is my class nameAny ideas?-Sergey-----Original Message-----From: rules-users-bounces@lists.jboss.org[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Jin, MingSent: Wednesday, October 03, 2007 1:50 PMTo: Rules Users ListSubject: RE: [rules-users] rules precompilationSergey,I am using precompiled rules. Serializing instances oforg.drools.rule.Package works for me.Thanks,-Ming-----Original Message-----From: rules-users-bounces@lists.jboss.org[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Manukyan,SergeySent: Wednesday, October 03, 2007 12:29 PMTo: Rules Users ListSubject: [rules-users] rules precompilationFolks,Where can I find information on how to pre-compile rules in 4.0.1?Thanks,-Sergey************************ LEGAL DISCLAIMER ************************This E-mail message and any attachments may contain legallyprivileged,confidential or proprietary information. If you are not the intendedrecipient(s), or the employee or agent responsible for delivery ofthismessage to the intended recipient(s), you are hereby notified that
any
dissemination, distribution or copying of this E-mail message isstrictly prohibited. If you have received this message in error,pleaseimmediately notify the sender and delete this E-mail message from
your
computer._______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users--View this message in context:
http://www.nabble.com/How-to-have-your-emails-ignored-tf4562290.html#a13
026864Sent from the drools - user mailing list archive at Nabble.com._______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users