Problem with rule file
by prateek.katiyar@wipro.com
Hello all,
I am using Drools 4.0.3 in my application in which I am generating the rule file from the front end.
I made my application in such a way that I can change my rule file during the runtime (i.e. server is running).
Each time when I submit my test form (on which validation is happening), the application executes from starting.
For this I am using "StatefulSession" and at the end of the program I am using "dispose" method to finish the session and I am using a "singleton" class in which in the constructor I am creating the "PackageBuilder" instance and loading a functionfile (which contains all the functions for the rules that I may include in my application at run time) only once per server start and shutdown. The functionfile is not going to change through out
the application.
My problem is that when I change my rule file at the runtime ,the rule file contents are changing accordingly but the validation is happening according to previous rules.
Now what can I do to come out from this problem?
Can I use "StatelessSession" ? If yes then please brief me that how can I use "AgendaGroup" with "StatelessSession" .
Any help will be appreciated.
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, 2 months
Rules firing with an update of another object
by Fabrice Granzotto
Hi everybody!
Here is my code and my rule. The problem is that the rule doesn?t detect that
my item ?chocolate? contained in the container has moved to the
?office?.
I know that if I update the item instead the container it?s working, but I was
wondering if there is a solution to detect this movement by this way? Do you
have a solution?
Thanks!
*******CODE *******
session = ruleBase.newStatefulSession();
Location kitchen=new Location("kitchen");
Location office=new Location("office");
Container container1=new Container("container1",kitchen);
session.insert(container1);
Item chocolate=new Item("chocolate", container1);
session.insert(chocolate);
session.fireAllRules();
//No rules fired => OK
container1.setLocation(office);
session.update(session.getFactHandle(container1), container1);
session.fireAllRules();
//Once again, no rules fired => Not OK... I want detect this movement
*******RULE *******
rule "An item is in the office"
salience 0
when
$itemA : Item($cont : container, $cont.location.name=="office")
then
System.out.println("item in office");
end
17 years, 2 months
infinite loop controlling
by Isabelle Hupont
Hi!
I'm developing a software where the user creates his own rules, saves then,
and finally fires them in order to preprocess a set of data.
I have implemented a method for controlling infinite loops (its simply a
timer). I would like to notify to the user the rule that has caused the
infinite loop, in order to change it. My code is the following:
public void fireRules(Instances instances) {
try {
assertInstances(instances);
// Worker thread to execute task that may hang.
WorkerThread workerThread = new WorkerThread();
// Wait for timeout or task end.
synchronized (this) {
workerThread.start();
try {
this.wait(60000);
} catch (InterruptedException e) {
log.error(e.getLocalizedMessage(),e);
}
if (!workerThread.isWorkDone()) {
// If work is not done then workingMemory.fireAllRules()
// hasn't finished (the timeout has expired).
workingMemory.halt();
// Here comes the code for capturing
rule that has code the loop
throw new PersistenceException("Operation timeout. Please modify rule
XXX" );
}
}
cleanWorkingMemory();
} catch (PersistenceException e) {
log.error(e.getLocalizedMessage(),e);
}
log.debug("Rule firing finished");
}
private class WorkerThread extends Thread {
private boolean workDone = false;
public boolean isWorkDone() {
synchronized (SingletonInferenceEngine.this) {
return workDone;
}
}
public void run() {
workingMemory.fireAllRules();
synchronized (SingletonInferenceEngine.this) {
workDone = true;
SingletonInferenceEngine.this.notifyAll();
}
}
}
Can you help me?
Thanks in advance!
--
View this message in context: http://www.nabble.com/infinite-loop-controlling-tf4675899.html#a13359512
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 2 months
problem with Drools 4.0.1.
by prateek.katiyar@wipro.com
hello all
I am using Drools 4.0.1.
I have one rule ( name = valsubmitLoanApplication#0_1193115386921 ) in my rule file. When I am running my application on Tomcat Server first time, the validation is happening properly. But when I am running the same application second time(the server is still running), I am getting the following exception :
java.lang.IllegalArgumentException: The rule called valsubmitLoanApplication#0_1193115386921 is not valid. Check for compi
le errors reported.
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:433)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:265)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:337)
at com.wipro.evalidator.validation.impl.DroolsValidator.getXMLRuleBase(DroolsValidator.java:477)
at com.wipro.evalidator.validation.impl.DroolsValidator.validateXML(DroolsValidator.java:308)
at com.wipro.evalidator.validation.impl.DroolsValidator.validate(DroolsValidator.java:213)
at com.wipro.evalidator.jbossaop.openrules.intercepts.WebTierInterceptor.invoke(WebTierInterceptor.java:57)
at com.wipro.evalidator.efaces.service.EmpLoanResponseService$submitLoanApplication_N4694083757408641873.invokeNex
t(EmpLoanResponseService$submitLoanApplication_N4694083757408641873.java)
at com.wipro.evalidator.efaces.service.EmpLoanResponseService.submitLoanApplication(EmpLoanResponseService.java)
at com.wipro.evalidator.efaces.service.EmpLoanRequestService.service(EmpLoanRequestService.java:92)
at com.wipro.efaces.server.webrender.WebRenderServlet.process(Unknown Source)
at com.wipro.efaces.server.webrender.WebRenderServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:6
64)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
validateXML() *********has created the RuleBase instance **************
java.lang.NullPointerException
at com.wipro.evalidator.validation.impl.DroolsValidator.validateXML(DroolsValidator.java:316)
at com.wipro.evalidator.validation.impl.DroolsValidator.validate(DroolsValidator.java:213)
at com.wipro.evalidator.jbossaop.openrules.intercepts.WebTierInterceptor.invoke(WebTierInterceptor.java:57)
at com.wipro.evalidator.efaces.service.EmpLoanResponseService$submitLoanApplication_N4694083757408641873.invokeNex
t(EmpLoanResponseService$submitLoanApplication_N4694083757408641873.java)
at com.wipro.evalidator.efaces.service.EmpLoanResponseService.submitLoanApplication(EmpLoanResponseService.java)
at com.wipro.evalidator.efaces.service.EmpLoanRequestService.service(EmpLoanRequestService.java:92)
at com.wipro.efaces.server.webrender.WebRenderServlet.process(Unknown Source)
at com.wipro.efaces.server.webrender.WebRenderServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:6
64)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
And if i shutdown the server and again start the server ,the same process happens.
Now please tell me that what can I do to resolve this problem?
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, 2 months
Attribute activations vs object activations
by Joshua Undesser
I am sorry if this has already been answered, I tried a few different search
combinations within this user forum and didn't find an answer.
I am pretty new to Drools, but am no stranger to JESS and CLIPS. We are
currently looking at moving over our product implementations from JESS to
DROOLS. In looking at what it will take to do the conversion, and working
with a few sample systems, i've noticed that DROOLS doesn't seem to support
attribute activations, only object activations. What I mean by this is
say that I have two rules.....
rule "Rule 1"
when
$o : ObjectType (type == OBJECTTYPE.STATIC )
then
System.out.println("ObjectType is Static");
end
rule "Rule 2"
when
$o : ObjectType (active == false)
then
System.out.println("ObjectType not active");
end
(My sample system is utilizing the default Drools 4.0 shadow fact support so
as an ObjectType object is created I am calling memory.insert(obj, true) for
dynamic updates.)
If on external property change event occurs on an ObjectType:active
attribute, both rules fire. Which to me signifies that if any attribute on
the ObjectType object happens, all rules that contain ObjectType on the LHS
of the rule will be re-evaluated (not re-fired, but re-evaluated). Now I
realize these rules are simple and that I could code the rules in a way to
avoid them being fired, but non the less, they would still need to be
evaluated to the point where the engine realizes it should run. Instead,
performance-wise, wouldn't it be more beneficial to only re-evaluate the
rules that contain the attribute that changed that you are interested in?
I.E. In the above scenario, only RULE 2 would fire because rule 1 doesn't
contain the attribute that changed.
The early versions of JESS did not support attribute activations (aka per
slot activations), which was a major stumbling block. However ever since
JESS 5.0, if I remember right, they've been included.
So I guess my question is, does DROOLS support attribute activations and I
am just blind? If Drools does not support this, is it scheduled to be
supported in the future?
Thank you in advance!
Joshua
17 years, 2 months
Final CfPart - RuleML-2007 in one week
by Adrian Paschke
FINAL CALL FOR PARTICIPATION
International RuleML Symposium on Rule Interchange and Applications
(RuleML-2007)
http://2007.ruleml.org/
We would like to kindly remind you that RuleML-2007 will be in one week
starting on October 25, 2007.
The International RuleML Symposium on Rule Interchange and Applications
(RuleML-2007) will take place, October 25-26, 2007, in Orlando, Florida
<http://2007.ruleml.org>, co-located with The 10th International
Business Rules Forum <http://www.businessrulesforum.com>. RuleML-2007 is
devoted to practical distributed rule technologies and rule-based
applications which need language standards for rules operating in the
context of, e.g., the Semantic Web, Web 2.0, Intelligent Multi-Agent
Systems, Event-Driven Architectures, and Service-Oriented Computing
Applications.
Registration:
-------------
If you plan participate in RuleML-2007, but have not registered yet,
please, register now at:
http://2007.ruleml.org/index-Dateien/Page930.htm
Accommodation:
--------------
RuleML-2007 will be co-located with the Business Rules Forum and take
place in Buena Vista Palace, Orlando, Florida:
http://2007.ruleml.org/index-Dateien/Page861.htm
If you haven't booked any hotel, please be quick as it's hard to predict
the room availability.
RuleML-2007 news:
-------------------------------------
1. RuleML-2007 program available at:
http://2007.ruleml.org/index-Dateien/Page646.htm
2. RuleML Keynotes, Panel, Challenge + BRF Expo
(http://www.rulesexpo.com/):
Registered RuleML-2007 participants can attend all of them free
Thank you,
Adrian Paschke
(RuleML-2007 Program Co-Chair)
Sponsorship from:
-------------------
NASA AMES Research Center <www.arc.nasa.gov>
Top Logic <http://www.top-logic.com>
Vistology <http://vistology.com/>
Inferware <http://www.inferware.com/>
In Co-operation with:
---------------------
ECCAI, AAAI, ACM, ACM SIGAPP, ACM SIGMIS, ACM SIGART, ACM SIGMOD, IEEE,
IEEE Computer TCAAS, IEEE SMCS, BPM-Forum, W3C, OMG, and OASIS
Supported by:
-------------
Springer LNCS, Business Rules Forum
17 years, 2 months
Error in upgrading to drools 4
by prashant sharma
Hi,
I have an application using drools 3.0.6. I downloaded jboss rules 4.0.2 GA and made necessary changes to the code to make it compatible to version 4.0.2. When I try to run the application now, I am getting following error.
2007-10-22 19:12:16,255 ERROR
[STDERR] java.lang.NoSuchMethodError:
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S
2007-10-22 19:12:16,255 ERROR
[STDERR] at
org.drools.lang.DRLParser.<clinit>(DRLParser.java:7205)
2007-10-22 19:12:16,255 ERROR
[STDERR] at
org.drools.compiler.DrlParser.getParser(DrlParser.java:204)
2007-10-22 19:12:16,255 ERROR
[STDERR] at
org.drools.compiler.DrlParser.parse(DrlParser.java:60)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:158)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
com.egatematrix.ess.framework.service.remote.rules.RulesEngineInvoker.readRule(RulesEngineInvoker.java:83)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
com.egatematrix.ess.framework.service.RuleService.doProcess(RuleService.java:294)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData.invokeRuleService(FetchFSSData.java:140)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData.triggerData(FetchFSSData.java:68)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData$1.run(FetchFSSData.java:84)
2007-10-22 19:12:16,256 ERROR
[STDERR] at
java.util.TimerThread.mainLoop(Timer.java:512)
2007-10-22 19:12:16,257 ERROR
[STDERR] at java.util.TimerThread.run(Timer.java:462)
I have antlr-runtime-3.0.jar in my classpath which came with drools 4 distribution. I don't have any other version of antlr in my classpath. Has anyone else encountered this problem? Any help will be appreciated.
thanks,
Prashant
17 years, 2 months
NoSuchMethodError
by Hehl, Thomas
OK, I upgraded to 4.0.2 and here is the updated error:
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult
.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(E
clipseJavaCompiler.java:321)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJ
avaCompiler.java:351)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(Abstrac
tJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDiale
ct.java:332)
at
org.drools.compiler.DialectRegistry.compileAll(DialectRegistry.java:6
0)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:308
)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.j
ava:167)
I have found this function in the file core-3.2.3.v_686_R32x.jar in the
drools/lib directory for 4.2.
One of the things that has happened recently is that I have upgraded from
3.2 to 3.3.1. I thought this might be part of the problem, but I looked at
the core jar for 3.3.1 and it has the same method.
The thing that puzzles me is that I'm not including the core file in my
distribution, but if that's the problem, why am I not getting a
ClassNotFoundException?
Thanks.
_____
From: Hehl, Thomas
Sent: Monday, October 22, 2007 10:04 AM
To: 'Rules Users List'
Subject: NoSuchMethodError
I am running 4.01 and I started get this exception on a new piece of code:
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult
.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(E
clipseJavaCompiler.java:335)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJ
avaCompiler.java:372)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(Abstrac
tJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDiale
ct.java:332)
at
org.drools.compiler.DialectRegistry.compileAll(DialectRegistry.java:6
0)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:287
)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.j
ava:160)
at
com.acs.gs.juror.workflow.RulesBasedWorkflowManager.init(RulesBasedWo
rkflowManager.java:114)
It is blowing up on this line of code:
builder.addPackageFromDrl( new StringReader(drl) );
Which is the drl created from the spreadsheet compiler on the decision
table.
This rules class has been tested thoroughly under junit. It wasn't until I
deployed the library into my webapp that this issue turned up.
Does anyone have any idea what I should be doing next?
Thanks.
Thom Hehl
Sr. eJuror Architect
* Office (859) 277-8800 x 144
* Thomas.Hehl(a)acs-inc.com <mailto:Thomas.Hehl@acs-inc.com>
ACS, Inc.
Government Solutions
1733 Harrodsburg Road
Lexington, KY 40504-3617
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message and notify
sender via e-mail at Thomas.Hehl(a)acs-inc.com
<mailto:Thomas.Hehl@acs-inc.com> or by telephone at 859-277-8800 ext. 144.
Thank you.
17 years, 2 months
NoSuchMethodError
by Hehl, Thomas
I am running 4.01 and I started get this exception on a new piece of code:
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult
.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(E
clipseJavaCompiler.java:335)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJ
avaCompiler.java:372)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(Abstrac
tJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDiale
ct.java:332)
at
org.drools.compiler.DialectRegistry.compileAll(DialectRegistry.java:6
0)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:287
)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.j
ava:160)
at
com.acs.gs.juror.workflow.RulesBasedWorkflowManager.init(RulesBasedWo
rkflowManager.java:114)
It is blowing up on this line of code:
builder.addPackageFromDrl( new StringReader(drl) );
Which is the drl created from the spreadsheet compiler on the decision
table.
This rules class has been tested thoroughly under junit. It wasn't until I
deployed the library into my webapp that this issue turned up.
Does anyone have any idea what I should be doing next?
Thanks.
Thom Hehl
Sr. eJuror Architect
* Office (859) 277-8800 x 144
* Thomas.Hehl(a)acs-inc.com <mailto:Thomas.Hehl@acs-inc.com>
ACS, Inc.
Government Solutions
1733 Harrodsburg Road
Lexington, KY 40504-3617
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message and notify
sender via e-mail at Thomas.Hehl(a)acs-inc.com
<mailto:Thomas.Hehl@acs-inc.com> or by telephone at 859-277-8800 ext. 144.
Thank you.
17 years, 2 months