Help with troubleshooting rules/Drools
by Robert Crawford
Any advice on how to troubleshoot problems? I have a fairly simple set of
rules (a couple dozen), but keep having problems with fatal exceptions. The
most recent was:
org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@1e60aa7
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
at
org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1231)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
at
com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.NoSuchElementException
at java.util.LinkedList.remove(LinkedList.java:788)
at java.util.LinkedList.removeFirst(LinkedList.java:134)
at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:264)
at
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:357)
at
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:238)
at
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:502)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:975)
... 6 more
No mention of a rule name, so where do I begin?
My architecture is simple: one thread ran fireUntilHalt(), other (multiple)
threads inserting objects. Should I synchronize on the session so only one
thread is inserting at a time?
There's one rule that triggers a large number of inserts, and it used to
give me problems, but I've moved those inserts into Commands and those
problems seem to have gone away.
Any advice would be welcome, no matter how basic you think it is! Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
Guvnor custom form not working for DSL sentences
by GPatel@tsys.com
Hi
Is the guvnor custom form not meant for use with fact fields appearing in
dsl sentences? It works fine with guided editor, not with dsl though.
Using 5.3.CR1
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 7 months
Online 5.3.0 javadocs
by Martin A
Hello,
I'm looking for the online 5.3.0 javadocs, but can't find it... Would you
point me to a reference?
Thanks,
Martin
14 years, 7 months
rule fires several times
by elsdestickere
Hi,
The Expert documentation says " a rule may fire once or several times", but
I don't understand why a rule sould fire several times if the objects state
does not change?
I have an example of a Customer object inserted in the Working Memory, with
2 rules that should fire, but the last rule fires twice.
Can someone explain?
rule "isAdult"
when
k : Customer( age(date)>=18, adult==false );
then
modify( k ) { setAdult(true) };
System.out.println( "Drools "+drools.getRule().getName()+": "+
k.getAdult() );
end
rule "WM"
when
k : Customer( ) ;
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName());
end
...
Customer bert = new Customer ();
bert.setName("Bert");
bert.setDate(30);
ksession.insert(bert);
ksession.fireAllRules();
...
Output:
Drools WM: Bert
Drools isAdult: true
Drools WM: Bert
Br,
Els Destickere
--
View this message in context: http://drools.46999.n3.nabble.com/rule-fires-several-times-tp3466250p3466...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
global as link to DB: different results
by elsdestickere
Hi,
I read docs about global and Hibernate to access your DB from the rules.
I tried something simular for in memory DAO's.
But some rules fire ("WM" in RHS) as the DAO has 3 items, but others ("dao"
in LHS) don't, how is that possible?
global RepositoryFactory repFact;
rule "dao"
when
k : Customer( ) from repFact.getCustomerRepository().findAll();
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName());
end
rule "WM"
when
k : Customer( ) ;
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName()+" + size: "+repFact.getCustomerRepository().findAll().size());
end
...
RepositoryFactory repFact = Registry.getRepositoryFactory();
ksession.setGlobal("repFact", repFact);
...
CustomerRepository customerRepo = Registry.getRepositoryFactory()
.getCustomerRepository();
customerRepo.add(tom);
customerRepo.add(elise);
customerRepo.add(bert);
ksession.insert(bert);
ksession.fireAllRules();
...
Output:
Drools WM: Bert + size: 3
br,
Els
--
View this message in context: http://drools.46999.n3.nabble.com/global-as-link-to-DB-different-results-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
Sliding Length Windows
by diana-mendes
Hello,
I'm having trouble using sliding length windows. Either I'm implementing
them wrong or I have misunderstood how they're supposed to work.
I have a class named Notif:
*public class Notif implements Serializable{
...
private String specificProblem;
...
public String getSpecificProblem() {
return specificProblem;
}
public void setSpecificProblem(String specificProblem) {
this.specificProblem = specificProblem;
}
}*
These Notif's represent my events. I want to know how many Notifs with
specificProblem "New ONT" are there in the last 2 received events.
My .drl file looks like this:
*declare Notif
@role( event )
end
rule "Rule1"
when
$event : Notif()
$nNewONT : Number() from accumulate (
Notif( specificProblem == "New ONT" ) over window:length(2), count() )
then
System.out.println("In the last 2 events there were "+$nNewONT+" events
'New ONT'");
end*
My test file:
*...
session.insert(ONTIsInactive1);
session.insert(newONT1);
session.insert(ONTIsInactive2);
session.insert(newONT2);
session.insert(LOKS1);
session.insert(LOKS2);
session.insert(LOKS3);
session.insert(newONT3);
session.fireAllRules(); *
As you probably can tell by the names, the events I'm looking for are the
2nd, the 4th and the last one.
But the output I get is:
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
The output I'm looking for is:
In the last 2 events there were 0 events 'New ONT' (because the received
event is "ONTIsInactive")
In the last 2 events there were 1 events 'New ONT' (because the last 2
received events are "ONTIsInactive" and "New ONT")
In the last 2 events there were 1 events 'New ONT' (because the last 2
received events are "New ONT" and "ONTIsInactive")
...
and so on...
What am I doing wrong? Any help would be appreciated!
Thanks in advance,
Diana
--
View this message in context: http://drools.46999.n3.nabble.com/Sliding-Length-Windows-tp3438408p343840...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
Time Window
by diana-mendes
Hello,
I want to implement a simple scenario using Drools, but I can't find the
right functions to do so.
I have a class named Notif that represents my events.
When I receive a Notif with a certain attribute (for example, type == "A") I
want to get a list of all the events I receive in the next 10 seconds.
If I receive a second event of type "A" during those 10 seconds, I don't
want to start another count. It should only restart the count after the 10
seconds have expired.
Example:
1s: Notif (type=="A") should start the 10 second count
2s: Notif (type=="B")
3s: Notif (type=="C")
4s: Notif (type=="A")
5s: Notif (type=="D")
12s: Notif(type=="E")
10 seconds after the first Notif(type=="A") I would like to receive the
following list:
Notif (type=="A")
Notif (type=="B")
Notif (type=="C")
Notif (type=="A")
Notif (type=="D")
Note that Notif(type=="E") (at 12 seconds) should not be in the list because
it's outside of the 10 seconds interval. Also, note that the second
Notif(type=="A") (at 4 seconds) should not start a new count because it's
included in the 10 seconds interval.
Thanks in advance,
Diana
--
View this message in context: http://drools.46999.n3.nabble.com/Time-Window-tp3468566p3468566.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
Turning off strict mode
by Alexander
Hello.
Is it possible to turn off strict mode in Drools 5.2 or 5.3 like in 5.1? How
can i do it?
We use Drools 5.1 and we use lots of maps so we turned off strict mode. I
tried to switch to Drools 5.2 or 5.3 but setting
System.setProperty("drools.dialect.mvel.strict", "false") doesn't work with
those versions. Our domain model is basicaly a hierarchy of Maps without
generics so using strict mode will force us to write alot of casts. This is
not acceptable cause we want our non technical guys to write some rules. One
of our goals was to make it possible to update our application without
recompiling and redeploying any java code only rules and flows, thats why we
have such "domain model".
--
View this message in context: http://drools.46999.n3.nabble.com/Turning-off-strict-mode-tp3468094p34680...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months