[rules-users] RE: RE: rules precompilation
Manukyan, Sergey
SManukyan at lear.com
Wed Oct 10 11:18:31 EDT 2007
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 at lists.jboss.org
[mailto:rules-users-bounces at 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 PackageBuilder
should be buit as in your example :
builder = new PackageBuilder((Package)ois.readObject());
and later on from that isnatcne should be retrieved the Package inctance
by doing:
package = buider.getPackage();
as otherwise this code was failing:
package = (Package)ois.readObject(); // FAILES, subsequent use
of package produces "class not found" exception when inserting objects.
Mark,
Think this should be documented somewhere in manual... under IMPORTANT
section... by the way, IMHO that section should be more visible from
what is used currently in manual... - thin italic font, how about bold
red?
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 at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of ekke
Sent: Tuesday, October 09, 2007 2:35 PM
To: rules-users at lists.jboss.org
Subject: [rules-users] RE: RE: rules precompilation
Sergey,
of course Mark is right - you shouldn't use readExternal and the default
constructor.
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....
}
...
// IMPORT
FileInputStream fis...
...
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(fis);
builder = new
PackageBuilder((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 at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of ekke
Sent: Wednesday, October 03, 2007 4:08 PM
To: rules-users at lists.jboss.org
Subject: [rules-users] RE: rules precompilation
sergey,
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()
from
Package)
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)
ekke
Manukyan, Sergey wrote:
Ming, Ekke,
After deserialising the Package back - getting exception
when
inserting
facts:
Exception thrown : java.lang.NoClassDefFoundError:
XXXShadowProxy
XXX - is my class name
Any ideas?
-Sergey
-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf
Of Jin, Ming
Sent: Wednesday, October 03, 2007 1:50 PM
To: Rules Users List
Subject: RE: [rules-users] rules precompilation
Sergey,
I am using precompiled rules. Serializing instances of
org.drools.rule.Package works for me.
Thanks,
-Ming
-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf
Of Manukyan,
Sergey
Sent: Wednesday, October 03, 2007 12:29 PM
To: Rules Users List
Subject: [rules-users] rules precompilation
Folks,
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
legally
privileged,
confidential or proprietary information. If you are not
the intended
recipient(s), or the employee or agent responsible for
delivery of
this
message to the intended recipient(s), you are hereby
notified that
any
dissemination, distribution or copying of this E-mail
message is
strictly prohibited. If you have received this message
in error,
please
immediately notify the sender and delete this E-mail
message from
your
computer.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://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
026864
Sent from the drools - user mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071010/ce5eccdd/attachment.html
More information about the rules-users
mailing list