Manners Benchmark broken!?
by ru
Hello drools-community,
I tried to run Manners Benchmark test and got this error message:
assign first seat : [Seating id=1 , pid=1 , pathDone=true , leftSeat=1,
leftGuestName=128, rightSeat=1, rightGuestName=128] : [Path id=1, seat=1,
guest=128]
find seating : [Seating id=2 , pid=1 , pathDone=false , leftSeat=1,
leftGuestName=128, rightSeat=2, rightGuestName=123] : [Path id=2, seat=2,
guest=123] : {Chosen id=1, name=123, hobbies=h2}
find seating : [Seating id=3 , pid=1 , pathDone=false , leftSeat=1,
leftGuestName=128, rightSeat=2, rightGuestName=122] : [Path id=3, seat=2,
guest=122] : {Chosen id=1, name=122, hobbies=h2}
Exception in thread "AWT-EventQueue-0" Exception executing consequence for
rule "pathDone" in org.drools.benchmark.manners:
java.lang.ClassCastException: org.drools.benchmark.manners.Seating cannot be
cast to org.drools.benchmark.manners.Context
at
org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1026)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:128)
at
org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:68)
at
org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:936)
at
org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1183)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:936)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:910)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:233)
at
org.drools.benchmark.manners.MannersBenchmark.main(MannersBenchmark.java:94)
at
org.drools.benchmark.DroolsBenchmarkExamplesApp$1.actionPerformed(DroolsBenchmarkExamplesApp.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.ClassCastException:
org.drools.benchmark.manners.Seating cannot be cast to
org.drools.benchmark.manners.Context
at
org.drools.benchmark.manners.Rule_pathDone929756542DefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
org.drools.benchmark.manners.Rule_pathDone929756542DefaultConsequenceInvoker.evaluate(Unknown
Source)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1016)
... 45 more
--
View this message in context: http://drools.46999.n3.nabble.com/Manners-Benchmark-broken-tp4026131.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Fusion 5.5 - Deterministically identifying event insert order?
by dunnlow
I am testing with fusion (5.5) and running into an /intermittent /issue. I
am trying to track transitions between two big events (BEvent) using a
smaller event (SEvents) with the properties I care about. The idea is that
I will maintain many SEvents in memory for the different kinds of BEvents.
My basic steps (partly driven by salience) are:
1) rule a: (salience=100): when a new BEvent is inserted, insert a new
related SEvent
2) rule b: (salience=50): If there are two SEvents for this type of BEvent,
compare them (old vs new) and act accordingly
3) rule c: (salience=0) remove the *old* SEvent (keeping the latest one)
4) rule d: (salience=-50) retract the BEvent
My rule c (above) is:
when $se1 : SEvent(name matches "auto")
$se2 : SEvent(this after $se1, style matches ($se1.style))
then
retract($se1);
end;
I am of course running in stream mode and this USUALLY works, but sometimes
rule c does not get activated - based on the audit log. Also, I have a
DebugWorkingMemoryEventListener configured and I can see that two SEvents DO
exist in working memory which should activate it.
In my test, I have a loop in which I am inserting events. When I add a
brief delay, I have not seen a failure. My guess is that the timestamps on
the two events are the same, thus the "after" is causing the issue.
However, I am unable to test this as the timestamp on the event is not
accessible (from what I have found on this forum).
I saw a suggestion here about using a variable on my SEvent to tell the
difference between a new and old version. I also considered using some sort
of counter bean to order the SEvents (although I believe it would need to be
serialized).
My questions:
1) Do you agree with my assessment? Is it possible in stream mode to have
two events with the same timestamp?
2) what is the BEST way to identify which event was inserted first?
Thanks for any insight!
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Fusion-5-5-Deterministically-identifyin...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Reg : Drools 5.5 Templates : CompoundValueRestrictions
by Barada (Native5)
Hi,
Am trying to model some rules using drools templates.
Currently the data inputs to rule templates are only strings, I need to be able to define a compound value restriction set for the rule i.e if fact attribute is present in a list. (see sample below).
e.g.
template header
dealers
template "my-template"
rule "my-rule"
when
$order : Order(dealer in (@{dealers}))
then
System.out.println("Order is present in dealer"
end
end template
I am trying to compile this template by passing it an Object which has a dealers attribute which is essentially a List<String>. Short of creating a function which sends back a comma separated representation of the list, does the drools compiler provide any option to send a list.
~ Barry
12 years, 2 months
NullPointer while deleting a rule since 6.0.0 upgrade
by Nicolas de Dreuille
Hey,
I recently upgraded drools from 5.5.0.Final to 6.0.0.CR3
A rule deletion that used to work now throws a NullPointerException.
A fact has to be inserted for the Exception to be thrown.
Here is the log :
[main] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl -
> KieModule was added:MemoryKieModule[
> ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
> objectInserted org.test.ProximityTest$Track@2c6c5356
> [Rule name=ProxRule, agendaGroup=MAIN, salience=0, no-loop=false]
> Exception in thread "main" java.lang.NullPointerException
> at org.drools.core.phreak.AddRemoveRule.deletePeerLeftTuple(
> AddRemoveRule.java:687)
> at org.drools.core.phreak.AddRemoveRule.followPeer(AddRemoveRule.java:659)
> at org.drools.core.phreak.AddRemoveRule.processLeftTuples(
> AddRemoveRule.java:620)
> at org.drools.core.phreak.AddRemoveRule.flushStagedTuples(
> AddRemoveRule.java:243)
> at org.drools.core.phreak.AddRemoveRule.removeRule(AddRemoveRule.java:134)
> at org.drools.core.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:172)
> at org.drools.core.reteoo.ReteooRuleBase.removeRule(
> ReteooRuleBase.java:1402)
> at org.drools.core.reteoo.ReteooRuleBase.removeRule(
> ReteooRuleBase.java:1393)
> at org.drools.core.reteoo.ReteooRuleBase.removeRule(
> ReteooRuleBase.java:1371)
> at org.drools.core.impl.KnowledgeBaseImpl.removeRule(
> KnowledgeBaseImpl.java:210)
> at org.test.ProximityTest.CreateKieRuleOnTheFly(ProximityTest.java:72)
> at org.test.ProximityTest.main(ProximityTest.java:102)
Here is a code sample that reproduces the issue :
package org.test;
> import java.util.ArrayList;
> import java.util.List;
> import org.kie.api.KieBase;
> import org.kie.api.KieServices;
> import org.kie.api.builder.KieBuilder;
> import org.kie.api.builder.KieFileSystem;
> import org.kie.api.builder.KieRepository;
> import org.kie.api.builder.Message.Level;
> import org.kie.api.definition.rule.Rule;
> import org.kie.api.event.rule.ObjectDeletedEvent;
> import org.kie.api.event.rule.ObjectInsertedEvent;
> import org.kie.api.event.rule.ObjectUpdatedEvent;
> import org.kie.api.event.rule.WorkingMemoryEventListener;
> import org.kie.api.runtime.KieContainer;
> import org.kie.api.runtime.KieSession;
> public class ProximityTest {
> private void CreateKieRuleOnTheFly() {
> KieServices ks = KieServices.Factory.get();
> KieRepository kr = ks.getRepository();
> KieFileSystem kfs = ks.newKieFileSystem();
> // Can't understand why this does not work without the
> // src/main/resources part
> kfs.write("src/main/resources/org/test/rule.drl", getRule());
> KieBuilder kb = ks.newKieBuilder(kfs);
> kb.buildAll();
> if (kb.getResults().hasMessages(Level.ERROR)) {
> throw new RuntimeException("Build Errors:\n"
> + kb.getResults().toString());
> }
> KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId());
> KieSession kSession = kContainer.newKieSession();
> kSession.addEventListener(new WorkingMemoryEventListener() {
> @Override
> public void objectUpdated(ObjectUpdatedEvent oue) {
> System.out.println("objectUpdated " + oue.getObject());
> }
> @Override
> public void objectInserted(ObjectInsertedEvent oi) {
> System.out.println("objectInserted " + oi.getObject());
> }
> @Override
> public void objectDeleted(ObjectDeletedEvent ore) {
> System.out.println("objectRetracted " + ore.getOldObject());
> }
> });
> // CloseTrack closeTrack = new CloseTrack(100,200);
> Track track = new Track(100);
> // track.getCloseTracks().add(closeTrack);
> // kSession.insert(track);
> // track = new Track(200);
> kSession.insert(track);
> kSession.fireAllRules();
> KieBase kieBase = kSession.getKieBase();
> Rule rule = kieBase.getRule("org.test", "ProxRule");
> System.out.println(rule);
> kieBase.removeRule("org.test", "ProxRule");
> System.out.println("done");
> }
> private static String getRule() {
> String s = ""
> + "package org.test"
> + "\nimport org.test.ProximityTest.*"
> + "\nrule \"ProxRule\""
> + "\nwhen "
> + "\n $track:Track("
> + "\n )"
> + "\n $track1:Track("
> + "\n )"
> + "\n exists (CloseTrack(closeTrackId==$track1.trackId) from
> $track.closeTracks)"
> + "\nthen " + "\nSystem.out.println(\"proximity asserted\"); "
> + "\nend";
> return s;
> }
> /** test main */
> public static void main(String[] args) {
> (new ProximityTest()).CreateKieRuleOnTheFly();
> }
> public class CloseTrack {
> private int trackId;
> private int closeTrackId;
> public CloseTrack(int i, int j) {
> this.trackId = i;
> this.closeTrackId = j;
> }
> public int getTrackId() {
> return trackId;
> }
> public void setTrackId(int trackId) {
> this.trackId = trackId;
> }
> public int getCloseTrackId() {
> return closeTrackId;
> }
> public void setCloseTrackId(int closeTrackId) {
> this.closeTrackId = closeTrackId;
> }
> }
> public class Track {
> private int trackId;
> private List<CloseTrack> closeTracks = new ArrayList<CloseTrack>();
> public Track(int i) {
> this.trackId = i;
> }
> public List<CloseTrack> getCloseTracks() {
> return closeTracks;
> }
> public int getTrackId() {
> return trackId;
> }
> public void setTrackId(int id) {
> this.trackId = id;
> }
> public void setCloseTracks(List<CloseTrack> closeTracks) {
> this.closeTracks = closeTracks;
> }
> }
> }
>
>
Hope this helps.
Thanks.
--
N.
12 years, 3 months
Does Guvnor limits the number of unsuccessful Login Attempts ?
by Zahid Ahmed
Hi,
I want to know that is there any configuration in Guvnor to limit the number of unsuccessful login attempts. This is required as I want to prevent Brute Force attack on my production Guvnor server.
Environment:
1. Drools-Guvnor 5.5.0-Final
2. Jboss EAP 6.1.0
Thanks and Best Regards,
Zahid Ahmed
12 years, 3 months
JBPM 6 Loop back.
by Naman Shah
I got a work flow, which has a loop back.
?node : yes--> do x /?node:no -->repeat previous
yes works and n o dont
and also i cant find entires into process instance data ,using which i can
see the process status.
I am using jbpm beta 6.05
Please find the attached BPMN for the same.
Node name where loop back dont work : inclusiveGateway id="_49"
and others too.
-----------------------------------------------------------------------------
12 years, 3 months
How To Implement Rule Flow
by neerajs20
Hi All,
I am new to drools and guvnor. I have basic question for rule flow.
I have created 3 rules using guided editor on guvnor plugin. Now I want to
invoke the 2nd or 3rd rule based on the outcome of 1st rule.
e.g. If the patient's age is less than 18 go for 2nd rule for minor checks
otherwise invoke 3rd rule for check from senior physician.
So can this be achieved using rule flow? If yes how? Is there any example
links, documents demonstrating it? Any help very much appreciated.
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/How-To-Implement-Rule-Flow-tp4025932.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Optaplanner rules error
by SNELS Nick
Hi,
I have the following Drools rule in Optaplanner:
rule "oneShiftPerDay"
when
$leftAssignment : ShiftAssignment($leftId : id, $employee : employee, $shiftDate : shiftDate, employee != null)
$rightAssignment : ShiftAssignment(employee == $employee, shiftDate == $shiftDate, id > $leftId)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
But when I run the solver I get the following error:
09:02:46.128 [main] ERROR o.d.c.k.b.impl.AbstractKieModule - Unable to build KieBaseModel:defaultKieBase
Error importing : 'be.comp.permanenties.domain.solver.EmployeeAssignmentTotal'
Error importing : 'be.comp.permanenties.domain.solver.EmployeeWorkSequence'
Rule Compilation error : [Rule name='oneShiftPerDay']
be/comp/permanenties/solver/Rule_oneShiftPerDay544009415.java (2:220) : Only a type can be imported. be.comp.permanenties.domain.solver.EmployeeWorkSequence resolves to a package
be/comp/permanenties/solver/Rule_oneShiftPerDay544009415.java (2:978) : Only a type can be imported. be.comp.permanenties.domain.solver.EmployeeAssignmentTotal resolves to a package
How can I solve this error? Thanks.
Kind regards,
Nick
[http://www.ocmwturnhout.be] <http://www.ocmwturnhout.be>
Dit bericht is onderworpen aan de bepalingen van onze disclaimer<http://www.ocmwturnhout.be/nl/content/2436>
12 years, 3 months
performance of ruleflowGroup
by ashish6276
Hi
I am exploring ruleflow. Can somebody help me in knowing how
RuleFlOWGROUP affects the performance of rules. Say i have 1 lakh rules.
what will be difference in performance if i keep all rules without any group
and if i group rules in diff small small ruleflowgroup and then create a
processflow to execute the flow in such a way where selected ruleflowgroup
will be used based on condition defined in process flow.
--
View this message in context: http://drools.46999.n3.nabble.com/performance-of-ruleflowGroup-tp4026085....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months