RE: firing specific rule
by Matt Geis
I ran into this unexpected behavior as well. I took a look at the Drools source and found that the rule filters filter out rules that MEET the criteria (unlike the java Filename Filter, which filters out those that do NOT meet the criteria.
So, if you want to run a VERY specific rule, you could create something like RuleNameNotEqualsFilter, and that would ensure that all rules except the one you want to fire have no chance of firing.
Then, of course, you would want to make sure that the facts you assert meet the conditions you've set up in the LHS of the rule.
Matt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
17 years, 1 month
BRMS Insurance Sample - Invalid Class Exception
by Paul Browne
Folks,
Using BRMS 4.0.2 and examples 4.02 as downloaded from the 'official
release' site.
Working my way through the Drools Insurance Sample (on BRMS). I'm
deploying BRMS successfully on JBoss 4.2.1 with Java 1.6.0_02. I can
import the repository_export.xml ok and see the files. I leave this part
of the sample running as per the instructions.
When I go to the 2nd part of the example I have a problem running the
unit tests: within /drools-examples/drools-insurance I run: mvn clean
package. I get the error(1) at the bottom of this email. I do *not* get
the output as per the documentaiton. I skip the tests, build and deploy
the drools-insurance.war
When deploying the war I see the following error (2) in the JBoss logs .
However main drools insurance page loads ok as per the screenshot in the
documentation):
22:43:13,576 INFO [WebappClassLoader]
validateJarFile(C:\software\jboss-4-2-1\server\default\.\tmp\deploy\tmp26632drool
s-insurance-exp.war\WEB-INF\lib\servlet-api-2.3.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
I enter some values in the web app (make sure there are no nulls) press
'continue' then get the same error (3)
22:48:55,294 ERROR [STDERR] java.io.InvalidClassException:
org.mvel.AbstractParser; local class incompatible: stream cla
ssdesc serialVersionUID = 256028721591955695, local class
serialVersionUID = -7464517220700761297
22:48:55,310 ERROR [STDERR] at
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
As an aside , when I look for the latest BRMS , as mentioned in the docs
(http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules) - I get a
'Invalid File or Directory'
Is there anything I should try to resolve this?
Paul
RuleAgent(insuranceconfig) INFO (Thu Oct 18 22:37:44 BST 2007):
Configuring package provider : URLScanner monitoring URL
s:
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.acme...
RuleAgent(insuranceconfig) EXCEPTION (Thu Oct 18 22:37:45 BST 2007):
org.mvel.AbstractParser; local class incompatible:
stream classdesc serialVersionUID = 256028721591955695, local class
serialVersionUID = -7464517220700761297. Stack trace
should follow..io.ObjectStreamClass.initNonProxy(Unknown Source)
java.io.InvalidClassException: org.mvel.AbstractParser; local class
incompatible: stream classdesc serialVersionUID = 25
6028721591955695, local class serialVersionUID = -7464517220700761297
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)rce)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)urce)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)rce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)ource)
at java.io.ObjectInputStream.readObject(Unknown Source)own Source)
at java.util.HashMap.readObject(Unknown Source)ce)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)known Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)urce)
at java.io.ObjectInputStream.readObject(Unknown Source) Source)
at org.drools.rule.Package.readExternal(Package.java:194)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown
Source)java:54)
at java.io.ObjectInputStream.readObject0(Unknown Source)va:137)
at java.io.ObjectInputStream.readObject(Unknown Source)java:109)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:137)0)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109))
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)48)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)ava:216)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)romRuleAgent(InsuranceSessionHelper.java:26)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)suranceSessionHelper.java:17)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:216)ntalInfoTest.java:23)
at
org.acme.insurance.web.InsuranceSessionHelper.loadRuleBaseFromRuleAgent(InsuranceSessionHelper.java:26)
at
org.acme.insurance.web.InsuranceSessionHelper.getSession(InsuranceSessionHelper.java:17)
at
org.acme.insurance.test.SupplementalInfoTest.setUp(SupplementalInfoTest.java:23)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)tive Method)
at junit.framework.TestSuite.runTest(TestSuite.java:208)ource)
at junit.framework.TestSuite.run(TestSuite.java:203)nknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)estSet.java:210)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)uteTestSet(AbstractDirectoryTestSuite.java:135
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)DirectoryTestSuite.java:122)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135
) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)ource)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)Process(SurefireBooter.java:225)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)oter.java:747)
at java.lang.reflect.Method.invoke(Unknown Source)psed: 0.671
sec <<< FAILURE!
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 0.655
sec <<< FAILURE!
Running org.acme.insurance.test.DriverTestped: 0, Time elapsed: 0 sec
<<< FAILURE!
Tests run: 7, Failures: 0, Errors: 7, Skipped: 0, Time elapsed: 0.016
sec <<< FAILURE!
Running org.acme.insurance.test.DriverAdditionalInfoTestlapsed: 0.015
sec <<< FAILURE!
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015
sec <<< FAILURE!
Running org.acme.insurance.test.InsuranceCalculateTest
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.016
sec <<< FAILURE!
17 years, 1 month
variable instance check?
by Eric Miles
In java, I can check to see if a 2 variables references the same
instance as such:
Object a = new Object();
Object b = a;
a == b
Is there a way to do this in Drools? For instance, if there is an
object in working memory and it is a specific instance, I do not want to
fire the rule again. ie:
rule "User Lookup UserKey"
salience 10000
when
com.kronos.taws.model.User(empId == null, $key:empIdKey)
then
System.out.println("Firing 2!");
insert($key);
end
I want to ensure that $key is not already in working memory. But mind
you, there might be other $keys that are in working memory that do not
belong to this particular com.kronos.taws.model.User instance. I do not
want this rule to fire because I have subsequent rules that will make
empId a value other than null.
I attempted to do this:
rule "User Lookup UserKey"
when
com.kronos.taws.model.User(empId == null, $key:empIdKey)
not UserKey(this == $key)
then
System.out.println("Firing 2!");
insert($key);
end
However, I still think this is doing an equality check because once the
$key object is updated in another rule, this rule is fired again!
Thanks in advance!
Eric
17 years, 1 month
Snapshot version?
by mmquelo massi
Hi again everybody!
What's the difference between the SNAPSHOT drools and the non-SNAPSHOT
drool???
Is it like a beta version??
I guess It is a really stupid question but I am a novice
and I need to ask u this.
Thank YOU AGAIN!!!
Massi
17 years, 1 month
Binding\synchronization between jboss\jbrms and eclipse\drool...
by mmquelo massi
Hi there,
I am a computer science student and I am writing my final thesis
on Open-source BRMSs.
Sorry for cross posting, I did not know which Mailing list
was the most appropriate for my questions...
I downloaded the Drools *drools-4.0.2-eclipse.zip* file,
I added it as ECLIPSE plug-in and everything went as
I expected.
Then I downloaded *drools-4.0.2-brms.zip* to have an
actual DROOLS BRMS, I deployed it in* ...\jboss 4.0.5\server\default*
directory and everything went fine.
Now I have got some simple questions......
How can I bind "eclipse-drools" with "jboss-drools"?
How can I make jbrms repository visible from\within eclipse?
I hope that the jbrms "xml export" function is not the only way
to do that.
I hope there is some kind of synchronization\bind between eclipse-drools
and jboss-jbrms repositories...... Am I dreaming something unreal?
Thank you very much for any help you can give me.
Looking forward to hear from you.
Massimiliano Magistri
17 years, 1 month
Error when deploying rules using RuleAgent
by igor_b
I'm serializing Package object of my rules so i could deploy it, but i am
having following error:
org.drools.RuntimeDroolsException: org.drools.RuntimeDroolsException:
ClassFieldExtractorFactory cannot have a null parent ClassLoader
at org.drools.base.ClassFieldExtractor.init(ClassFieldExtractor.java:82)
at org.drools.base.ClassFieldExtractor.<init>(ClassFieldExtractor.java:58)
at
org.drools.base.ClassFieldExtractorCache.getExtractor(ClassFieldExtractorCache.java:35)
at
org.drools.base.ClassFieldExtractor.readResolve(ClassFieldExtractor.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at java.util.ArrayList.readObject(ArrayList.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at java.util.HashMap.readObject(HashMap.java:1029)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at
org.drools.rule.PackageCompilationData.readExternal(PackageCompilationData.java:151)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.drools.rule.Package.readExternal(Package.java:174)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.drools.agent.FileScanner.readPackage(FileScanner.java:97)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at
org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:327)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:295)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:281)
at org.drools.agent.RuleAgent.init(RuleAgent.java:205)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:173)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:145)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:213)
Anyone has idea what could be the error.
edit: i've check my drl source, and it's working, but when i try to
serizliaze, and using it with RuleAgent, this error occurs.
Kind regards!
--
View this message in context: http://www.nabble.com/Error-when-deploying-rules-using-RuleAgent-tf464626...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
memory leak in 4.0.2
by Mark Proctor
For stateful sessions a memory leak has been found, and fixed, for 4.0.2
http://jira.jboss.org/jira/browse/JBRULES-1279
We will release 4.0.3 early next week that address this issue. Stateless
sessions are not affected, but if you are using stateful with lots
sessions on the same rulebase then its recommended you stay with 4.0.1
until we release 4.0.3 next week.
Mark
17 years, 1 month
java.io.InvalidClassException: org.drools.rule.Package; local class incompatible: stream classdesc serialVersionUID = 400, local class serialVersionUID = 320
by vamshidhar reddy chitti
hello
am using the binary package from drools brms and tying to execute
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( DroolsTest.class.getResourceAsStream( "com.valuemomentum.ipru.camscontract.model.pkg" ) );
RuleBase rb = loader.getRuleBase();
but i get the following errors,
org.drools.RuntimeDroolsException: java.io.InvalidClassException: org.drools.rule.Package; local class incompatible: stream classdesc serialVersionUID = 400, local class serialVersionUID = 320
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:100)
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:67)
at com.sample.DroolsTest.readRule(DroolsTest.java:59)
at com.sample.DroolsTest.main(DroolsTest.java:28)
Caused by: java.io.InvalidClassException: org.drools.rule.Package; local class incompatible: stream classdesc serialVersionUID = 400, local class serialVersionUID = 320
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:82)
... 3 more
i tried replacing mvel jar file with mvel-snapshot jar file...but same error...
anyone has idea.
how to use absolute path in my application instead downloading binary package and using.
thanx in advance.
vamshi
---------------------------------
Yahoo! Clever - Sie haben Fragen? Yahoo! Nutzer antworten Ihnen.
17 years, 1 month
about function in rule file
by prateek.katiyar@wipro.com
Hi all
I am using Drools 4.0.
I have written a function in a rule file and i want to use that function in another rule file.
Please tell me what should i do for this.
Thanks.
With Regards
Prateek
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 1 month