Re: [rules-users] Annotation @PropertyReactive not works
Regarding the @Pr issue: yes, afaik newer versions are fixed. If not, they are more likely to be fixable. Thanks Davide On 08/09/2014 12:34 PM, Michael Anstis wrote: Regarding the Guvnor question; we don't support the time element of dates at the moment. It should however be a simple change and I am happy to support you submitting a pull request to fix in a later version. Unfortunately we simply do not have the time to fix ourselves at present. Sent on the move On 9 Aug 2014 16:20, David Moros Claramunt davidmo...@gmail.com mailto:davidmo...@gmail.com wrote: Do you know if the issue is solved in some later version? Also, I have another problem with Guvnor, in scenarios test I can´t set a date with time in Date field, is possible set it?I have changed the format Date and DateTime in .properties but fail the conversion too thanks, 2014-08-08 15:26 GMT+02:00 Davide Sottara dso...@gmail.com mailto:dso...@gmail.com: If I remember correctly this is a known issue. Unfortunately drools 5.6 is final and can't be patched. Downloading the source drl rather than the compiled pkg could be a workaround. Please let me know if it works Sent via the ASUS PadFone X, an ATT 4G LTE smartphone Original Message From:davidmoros davidmo...@gmail.com mailto:davidmo...@gmail.com Sent:Fri, 08 Aug 2014 05:03:29 -0500 To:rules-users@lists.jboss.org mailto:to%3arules-us...@lists.jboss.org Subject:[rules-users] Annotation @PropertyReactive not works I'm developing a system rules with drools, how any novice I found the problem of infinite loops, in unitary test I resolved with annotation @PropertyReactive and all works fine, until I uploaded my model and rules to Guvnor. Now I have developed a webservice that download the PKG from Guvnor, with change-set and seems that the annotation @PropertyReactive not works because of the same rule is reevaluated constantly although the consecuences the rule not change the value of attributes of LHS of rule, and infinite loops appears The error only occurs when I download the PKG from Guvnor, if I refer the file DRL directly all woks fine Can anybody help me? I use 5.6.0.Final Version for Drools and Guvnor, Guvnor and my webservice are deployed in Tomcat Thanks in advance -- View this message in context: http://drools.46999.n3.nabble.com/Annotation-PropertyReactive-not-works-tp4030602.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Annotation @PropertyReactive not works
If I remember correctly this is a known issue. Unfortunately drools 5.6 is final and can't be patched. Downloading the source drl rather than the compiled pkg could be a workaround. Please let me know if it works Sent via the ASUS PadFone X, an ATT 4G LTE smartphone Original Message From:davidmoros davidmo...@gmail.com Sent:Fri, 08 Aug 2014 05:03:29 -0500 To:rules-users@lists.jboss.org Subject:[rules-users] Annotation @PropertyReactive not works I'm developing a system rules with drools, how any novice I found the problem of infinite loops, in unitary test I resolved with annotation @PropertyReactive and all works fine, until I uploaded my model and rules to Guvnor. Now I have developed a webservice that download the PKG from Guvnor, with change-set and seems that the annotation @PropertyReactive not works because of the same rule is reevaluated constantly although the consecuences the rule not change the value of attributes of LHS of rule, and infinite loops appears The error only occurs when I download the PKG from Guvnor, if I refer the file DRL directly all woks fine Can anybody help me? I use 5.6.0.Final Version for Drools and Guvnor, Guvnor and my webservice are deployed in Tomcat Thanks in advance -- View this message in context: http://drools.46999.n3.nabble.com/Annotation-PropertyReactive-not-works-tp4030602.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] NPE in LeftTupleSetsImpl.removeUpdate
It has almost certainly been fixed in 6.1 Davide On 07/31/2014 03:40 AM, David Zeigler wrote: Hi, I'm using drools 6.0.1.Final. I received a NPE in the org.drools.core.common.LeftTupleSetsImpl.removeUpdate() method on line 172, which corresponds to this line for 6.0.1.Final: previous.setStagedNext( next ); I see 2 commits in 6.1.0 to address NPEs in this class but I'm not sure if either of those cover this particular NPE. I'm unable to reproduce this issue with my code after the first occurrence. Does anyone know if this has been fixed in 6.1.0? Please let me know if I can provide additional info or if I should open a defect in Jira. Thanks, David Here is the stack trace: java.lang.NullPointerException at org.drools.core.common.LeftTupleSetsImpl.removeUpdate(LeftTupleSetsImpl.java:172) at org.drools.core.common.LeftTupleSetsImpl.addDelete(LeftTupleSetsImpl.java:84) at org.drools.core.common.SynchronizedLeftTupleSets.addDelete(SynchronizedLeftTupleSets.java:20) at org.drools.core.reteoo.LeftInputAdapterNode.doDeleteSegmentMemory(LeftInputAdapterNode.java:339) at org.drools.core.reteoo.LeftInputAdapterNode.doDeleteObject(LeftInputAdapterNode.java:301) at org.drools.core.reteoo.LeftInputAdapterNode.retractLeftTuple(LeftInputAdapterNode.java:417) at org.drools.core.reteoo.ObjectTypeNode.doRetractObject(ObjectTypeNode.java:352) at org.drools.core.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:335) at org.drools.core.reteoo.EntryPointNode.retractObject(EntryPointNode.java:395) at org.drools.core.common.NamedEntryPoint.delete(NamedEntryPoint.java:605) at org.drools.core.common.AbstractWorkingMemory.delete(AbstractWorkingMemory.java:1184) at org.drools.core.common.AbstractWorkingMemory.delete(AbstractWorkingMemory.java:1176) at org.drools.core.impl.StatefulKnowledgeSessionImpl.delete(StatefulKnowledgeSessionImpl.java:316) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Are globals not permitted with queries?
Confirmed, the NPE is a bug.. The use case was not covered. A tentative fix is here, we'll discuss it next week https://issues.jboss.org/browse/DROOLS-564 https://github.com/sotty/drools/commit/9db38d098e67560839b36661bdf24a5f5cdae1df Davide On 07/23/2014 10:56 PM, Borris wrote: I want to pass strings around between rules and queries to control their actions and provide control values. I know I can just use literals but I know from past experience that that leads to small typos not being detected (either at compile time or run time) and leads to nasty subtle errors down the line. For rules, you can over come this with a bunch of public static final String in a class (I call mine Consts) - and then any spelling mistakes become compile time issues as you are matching against a variable/constant name and if you spell this right then you know you get the right control string. But does anyone have a technique that works with queries? I know lots of the docn talks about queries being things you can invoke from Java. But I use queries in my rules (they have a private stack and support recursion that rules don't quite do in the same way). Does anyone have a clever technique they've used in the past? Thanks Borris On 22/07/2014 17:16, Davide Sottara wrote: The case may not be supported, but even then, it should be reported as a compilation error, not as a NPE I'll investigate and report back later Thanks Davide On 07/22/2014 05:48 PM, Borris wrote: I was experimenting with ways of avoiding having to put literal strings into my rules (it is very fragile and bugs can be silent for a long time). I tried declaring a global and then tried supplying it to a query. This generates a backtrace during the newKieSession. A simple example to provoke the problem: KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(ksession-rules); kSession.setGlobal(AString, Hello World); kSession.fireAllRules(); package com.sample global java.lang.String AString; declare Thing name: String @key end rule init when then insert( new Thing( AString ) ); end query test(String $in) Thing( $in; ) end rule spot when test( Hello World; ) Thing( Hello World; ) test( AString; ) Thing( AString; ) then System.out.println(found msg\n); end java.lang.NullPointerException at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:243) at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:263) at org.drools.core.rule.LogicTransformer.fixClonedDeclarations(LogicTransformer.java:134) at org.drools.core.rule.LogicTransformer.transform(LogicTransformer.java:99) at org.drools.core.definitions.rule.impl.RuleImpl.getTransformedLhs(RuleImpl.java:560) at org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:105) at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:100) at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1455) at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1435) at org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:838) at org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:266) at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:412) at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:346) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:498) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:469) at com.sample.DroolsTest.main(DroolsTest.java:17) The 3rd action in the spot rule causes the null exception during initialise, if it is present. Comment out just that line and no exceptions happen and behaviour is as expected. Are globals permitted in the way I am trying to use them, as a parameter to a query? Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo
Re: [rules-users] Defeasible: NPE: with multiple @Defeasible
Fixed, in PR status. It was indeed another bug. https://github.com/sotty/drools/commit/7941a0c8d7e66c6c7719c14ca58d798337d067d8 Thanks for reporting, we really appreciate the feedback Davide On 07/23/2014 10:58 PM, Borris wrote: On 22/07/2014 22:44, Mark Proctor wrote: Stack trace shows the error: org.drools.core.beliefsystem.defeasible.DefeasibleBeliefSet.removeUndefeated(DefeasibleBeliefSet.java:295) https://github.com/sotty/drools/blob/master/drools-core/src/main/java/org/drools/core/beliefsystem/defeasible/DefeasibleBeliefSet.java Maybe have a go fixing it yourself? And submit the fix with a unit test, as a pull request? http://docs.jboss.org/drools/release/5.6.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html I might well have a go, but there's a whole bunch of learning I need to do before I can submit my first candidate patch. So don't expect something too quickly. Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] [optaplanner] creating dynamic fact classes(planning entity and planning variables) in Optaplanner
Declared types support annotations. You'll have to import it package my.drl; import my.SomeAnnotation; declare Foo @SomeAnnotation bar : String end When the declare is processed, the class builder will try to resolve the annotation and, if found, will wire it to the class being generated. If this does not work, it's a bug, so please report it as such. Davide On 07/24/2014 11:19 AM, colorful.world wrote: Hi Geoffrey, Thanks for reply. What we use for declaring fact type is just to have class declaration in drl file. Since this drl string is loaded at runtime, we are able to have dynamic class structures and drools rules from DB. So, I am wondering if we can have dynamic Planning Entity and Variables in Optaplanner. Please share, if you have another similar ideas to achieve this. -- View this message in context: http://drools.46999.n3.nabble.com/optaplanner-creating-dynamic-fact-classes-planning-entity-and-planning-variables-in-Optaplanner-tp4030473p4030476.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Dynamically loading rules in KieBase
You can add rules programmatically to an existing KieBase, but you have to: 1) add/replace the resource in the KieFileSystem 2) Cast the KieBuilder to InternalKieBuilder and use the incrementalBuild() method 3) Enjoy and report problems as this is a newer feature See the test suite here https://github.com/droolsjbpm/drools/blob/184765346e998430064a4935fbb358930946d82c/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java the latest tests show the use of the incremental builder Davide On 07/22/2014 04:20 PM, marianbuenosayres wrote: I'm bumping this question for general interest on other possible solutions, and to give my two cents. The closest I was to getting this feature in Drools 6 from the public APIs, is to use a persistent session. Then, when I loaded an existing session, I would pass a newly created KieBase, like this KieStoreServices kstore = KieServices.Factory.get().getStoreServices(); KieBase kbase = ...; //create a Kie Base Environment env = ...; //create an environment KieSession ksession = kstore.newKieSession(kbase, null, env); Integer sessionId = ksession.getId(); KieBase kbase2 = ...; //updated Kie base KieSession ksessionReloaded = ks.loadKieSession(kbase2, null, env); ksession and ksessionReloaded would be the same working memory and agenda, but the kie base they work with would change. Hope this helps, but I hope more for an alternative -- View this message in context: http://drools.46999.n3.nabble.com/Dynamically-loading-rules-in-KieBase-tp4030351p4030425.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Are globals not permitted with queries?
The case may not be supported, but even then, it should be reported as a compilation error, not as a NPE I'll investigate and report back later Thanks Davide On 07/22/2014 05:48 PM, Borris wrote: I was experimenting with ways of avoiding having to put literal strings into my rules (it is very fragile and bugs can be silent for a long time). I tried declaring a global and then tried supplying it to a query. This generates a backtrace during the newKieSession. A simple example to provoke the problem: KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(ksession-rules); kSession.setGlobal(AString, Hello World); kSession.fireAllRules(); package com.sample global java.lang.String AString; declare Thing name: String @key end rule init when then insert( new Thing( AString ) ); end query test(String $in) Thing( $in; ) end rule spot when test( Hello World; ) Thing( Hello World; ) test( AString; ) Thing( AString; ) then System.out.println(found msg\n); end java.lang.NullPointerException at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:243) at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:263) at org.drools.core.rule.LogicTransformer.fixClonedDeclarations(LogicTransformer.java:134) at org.drools.core.rule.LogicTransformer.transform(LogicTransformer.java:99) at org.drools.core.definitions.rule.impl.RuleImpl.getTransformedLhs(RuleImpl.java:560) at org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:105) at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:100) at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1455) at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1435) at org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:838) at org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:266) at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:412) at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:346) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:498) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:469) at com.sample.DroolsTest.main(DroolsTest.java:17) The 3rd action in the spot rule causes the null exception during initialise, if it is present. Comment out just that line and no exceptions happen and behaviour is as expected. Are globals permitted in the way I am trying to use them, as a parameter to a query? Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] DROOLS-516 - Continued Memory Leak problem Drools 6.1.0.
Ack'd and queued. On 07/22/2014 11:46 PM, Kent Anderson wrote: It appears there is another condition where Drools holds onto memory indefinitely. (See https://issues.jboss.org/browse/DROOLS-516) Use case: We have a set of rules designed to detect a heartbeat, then report when/if the heartbeat stops. Problem: In the normal case of a constant heartbeat, memory is retained in the JVM, even though the fact count in working memory is 1. The following rules produce this problem. I have attached a test project that demonstrates this problem. 600K events are inserted into the stream, then the test driver waits. After 10 seconds, the absence detected rule fires. Requesting a GC via JMC has no effect. If you hit a key while the test driver is waiting, a new event will be added, which will cause the clear absence alarm rule to fire. At this point some memory is freed automatically. Requesting another GC removes all memory and the JVM is back in its (nearly) new condition. We consider this a memory leak since the events are gone from working memory and will no longer be considered in any rule evaluations, but they are still active somewhere in the JVM. packageorg.drools.example.api.kiemodulemodel import demo.Event declareEvent @role( event ) @timestamp( timestamp ) end declare Heartbeat @role( event ) @timestamp( event.timestamp ) event : Event end declare AbsenceDetected name: String end /* * This rule matches the first event * * NOTE: This stream requires the heartbeat event * to occur at least once before absence will be detected. */ ruledetect first heartbeat when $event : Event() not ( Heartbeat() ) then delete($event); insert(new Heartbeat($event)); System.out.println([DFH] Got event: + $event.getEventId()); end /* * This rule matches every event and stores only the most recent * as the heartbeat. */ rulekeep latest heartbeat when $heartbeat : Heartbeat() $event : Event() then delete($heartbeat); insert(new Heartbeat($event)); System.out.println([KLH] Got event: + $event.getEventId()); delete($event); end /* * This rule detects when a heartbeat stops for 10s */ ruledetect absence duration(10s) when $heartbeat : Heartbeat() not ( Event() ) not (AbsenceDetected() ) then delete($heartbeat); insert(new AbsenceDetected(Absence)); System.out.println([DA] Absence detected); end /* * This rule detects when the heartbeat starts again after * absence has been detected. */ ruleclear absence alarm when $heartbeat : Heartbeat() $absence : AbsenceDetected () then delete($absence); System.out.println([CAA] Heartbeat restored); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Question about getObjects() on workspace with defeasible belief system
Thanks for the feedback! The defeasible subsystem is still very experimental, and it's good to know that people are using it. This said, as for your question. It is possible, but takes a little effort since we don't have a public API for that. You can do: // get the handle for the object InternalFactHandle handle = (InternalFactHandle) session.getFactHandle( myObject ); // lookup the belief set, where all justifiers (pos and neg) are stored and linked DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) posHandle.getEqualityKey().getBeliefSet(); DefeasibilityStatus status = dbs.getStatus(); status now has 4 values: DEFINITELY (strict), DEFEASIBLY, DEFEATEDLY (defeated), UNDECIDEDLY (unresolved conflict) Notice that negatively asserted facts end up in a negative entry point, so you have to look them up explicitly: InternalFactHandle negHandle = (InternalFactHandle) session.getEntryPoint( neg ).getFactHandle( myNegatedObject ); Again, we are currently working on this specific system even now, so things may change in 6.2, but this should work in 6.1. Please report any issue that you might find. Best Davide On 07/21/2014 08:57 PM, Borris wrote: I am trying the Defeasible belief system (it ties in pretty well with some of how I want to structure my project). After fixing many typos, the rule behaviour seems to be what it should for a defeasible rule being correctly defeated (my clash spotter doesn't fire, which it does if any part of the defeasible chain is broken). Which is all jolly fun and good and exciting. But, my question. I have a simple workspace dump based upon getting all objects (via ksession.getObjects() ) and then doing my own tidy presentation. This still shows the defeated fact as present. So I know there is still record somewhere of the defeated fact, because if the workspace changed such that my defeater was retracted, then it needs to make the fact visible again. But I wasn't expecting to see it via getObjects(). Is that the intended behaviour? If so, is there a way to enquire whether a fact is in the defeated state or not that I could add to my tidy workspace dumper? Thanks! Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Question about getObjects() on workspace with defeasible belief system
getObjects() will return all the objects. However, an object's HANDLE will be in the default x-or in the neg entry-point, depending on whether the object was asserted in the positive or negative form, and depending on the conflict resolution by defeasibility. In my snippet, myNegatedObject was supposedly an object in negative form. If you are trying to build a pretty printer, you may just want to iterate the fact handles directly. Methods such as session.getEntryPoints() session.getEntryPoint( entryPointName ).getFactHandles(); will help On 07/22/2014 12:41 AM, Borris wrote: And thanks for the response! A quick question on your example code before I try it: On 21/07/2014 21:24, Davide Sottara wrote: Notice that negatively asserted facts end up in a negative entry point, so you have to look them up explicitly: InternalFactHandle negHandle = (InternalFactHandle) session.getEntryPoint( neg ).getFactHandle( myNegatedObject ); Is myNegatedObject just the set that getObjects() returned or is there another enumeration method I should use? Ie do I Iook for a neg entry point object for each object I get back from ksession.getObjects() or do I need to acquire a collection from another place (as well) if I want to enumerate everything in the workspace for my dumpWorkspace() pretty printer? Thanks Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when I cleaning the production memory.
Not checking for nulls is a debatable behavior :) In 5.6 you should be able to use the null safe accessor Business activity.!status == ... Which will be rewritten to do the check for you On Jul 16, 2014 4:33 AM, braveheart85 andrea.pacifico...@gmail.com wrote: Yesterday I tried version 5.6. I have had a problem with the MVEL syntax. rule RULE1 $result: PersonData( businessActivity.status == CLOSED ) end This rule that works in the version 5.5, now have a problem in version 5.6: unable to invoke method: org.titan.registry.filter.BusinessActivityData.getStatus: target of method is null The problem is that not all Person facts inside the working memory have a business activity. NullPointer would be quite correct but in version 5.5 the behaviour was different... Maybe I'm abusing of your kindness. Andrea -- View this message in context: http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030367.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when I cleaning the production memory.
Oops, it's !., not .! On Jul 16, 2014 5:39 AM, braveheart85 andrea.pacifico...@gmail.com wrote: I have tried your hint and i got: query dis $result : PersonData( businessActivity.!status == CLOSED) end [48,38]: [ERR 101] Line 48:38 no viable alternative at input '.' in query [0,0]: Parser returned a null Package -- View this message in context: http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030369.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when I cleaning the production memory.
What are you trying to do exactly when you clear the knowledge base? If you need to replace all the rules, I'd just create a new KB altogether.. facts would be reasserted into the new rules anyway. If you need to update some of the rules, Drools 5.x had the KnowledgeAgent for this purpose. To be fair, however, in 5.5 it still had some issues that were fixed in 5.6. I may be missing some of the requirements, though. Davide On 07/15/2014 10:19 AM, braveheart85 wrote: I suppose the problematic query is: query Get Fixed BusinessEntities $result : BusinessEntityData( queryable == true ) end What you means with increase and decrease node sharing? Sorry, maybe I didn't study very well the reteeo part of the documentation. -- View this message in context: http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030355.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when I cleaning the production memory.
Conceptually you are right, but in practice, when you add a rule/query to the KBase all the available facts are propagated through the newly built piece of RETE. Since you clear all the rules first (which has some cost) and then you build a new set of rules, the effect is very similar - only, the engine will implicitly re-insert the objects for you. Now, a clean insertion has some costs (like the creation of the handles), so it would be interesting to benchmark the two alternatives. From a developer's perspective, moving the objects from a session into another is as simple as this: for ( Object o : oldSession.getObjects() ) { newSession.insert( o ); } and if you can't (re)compile the source code, there is little that can be done to solve your problem. Unless there is a multi-threading issue, that is, you have different threads adding facts, removing rules/queries and adding the new ones. If that was the case, I would not be surprised since 5.5 was not thread safe. Davide On 07/15/2014 02:29 PM, braveheart85 wrote: My users can apply a filter (query in Drools) and the result facts are tagged to be shown. Filters can be from a filter library or also directly written by users. I need to clear the production memory and set new knowledge (filter) each time in order to get filter result. First solution you propose is a bit problematic for me because i'd have to reinsert all facts inside the working memory but I don't keep these objects outside Drools. In my context facts are fixed while rules/queries are variables. I'd have to query Drools for all facts, then instantiate a new KnowledgeBase and finally reinsert all facts... What do you think? Thanks Andrea -- View this message in context: http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030361.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when I cleaning the production memory.
Can you try 5.6 or a later version? That part of logic was improved in 5.6, and rewritten in 6.x Davide On 07/14/2014 04:54 PM, braveheart85 wrote: I forgot to say what version I'm using. The version of Drools is 5.5. -- View this message in context: http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030342.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Workaround: EventFactHandle retained in memory after FactCount reaches 0 for temporal-based rule
Thanks, we'll look at it tomorrow Davide On 07/15/2014 02:09 AM, Kent Anderson wrote: https://github.com/droolsjbpm/drools/pull/358 Per your advice, this pull request sets up the memory leak, but it cannot verify that it exists without diving into internal drools structures. Please let me know what else we can do to facilitate fixing this issue. On Jul 14, 2014, at 2:09 PM, Davide Sottara dso...@gmail.com wrote: I'd need to check, but if you can put together the basics of the test case - the combination of rules and facts that causes the leak, we'll add the checks to ensure it's solved. Mark should have given you enough pointers to the style we use for test cases. We really appreciate your collaboration, and since this is a critical bug we'll fix it asap Thanks!! Davide On 07/14/2014 08:33 PM, Kent Anderson wrote: Is there a reliable way to find an EventFactHandle instance buried within the TupleEntryQueue's and the PhreakPropagationContext's? The multiple containers of interface/impl's makes it nearly impossible to write a good test that can peak under the hood where this memory leak is being held. If there is a recommended way to do it, I'd be happy to do so. Mail Attachment.png On Jul 13, 2014, at 7:31 PM, Mark Proctor mproc...@codehaus.org mailto:mproc...@codehaus.org wrote: Could you submit a unit test as a pull request? http://docs.jboss.org/drools/release/5.5.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html Add it to here, and follow existing conventions: https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/CepEspTest.java Mark On 11 Jul 2014, at 20:38, Kent Anderson kent.ander...@psware.com mailto:kent.ander...@psware.com wrote: We have found a workaround that eliminates the leftover event (gone from Working Memory, but not from the JVM memory): The rule forget it ever happened (seen below) causes the problem. Re-writing it to remove the check for RAISE in the LHS eliminated the memory leak. Of course, our application requires the check for RAISE, so it can be accomplished by manually querying working memory from the RHS. It's ugly, but it resolved the issue. query existsRaise($id) $raise : MyEvent( eventState == EventState.RAISE, eventId == $id ) end rule process clear no-loop when $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId) then QueryResults results = kcontext.getKieRuntime().getQueryResults( existsRaise, $clearId ); if (results.size() == 0) { System.out.println( Forwarding CLEAR( + $clearId + ) ); } else { System.out.println(Forgetting RAISE/CLEAR( + $clearId + )); for (QueryResultsRow row : results){ MyEvent raise = (MyEvent) row.get ($raise); delete(raise); } } delete($clear); end This appears to be a similar situation to https://issues.jboss.org/browse/DROOLS-498. On Jul 10, 2014, at 3:54 PM, Kent Anderson kent.ander...@psware.com mailto:kent.ander...@psware.com wrote: Correction: The original post did not include another rule that exists in the stream. The memory leak does not appear unless both rules are active in the stream. declare MyEvent @role(event) @timestamp(timestamp) end /* If a RAISE is buffered for N seconds, send it out */ rule forward raise no-loop duration (3s) when $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId) then System.out.println(Forwarding RAISE( + $raiseId + )); delete($raise); end /* When CLEAR, and buffered, clear them both out */ rule forget it ever happened no-loop when $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId) $raise : MyEvent(eventState == EventState.RAISE, eventId == $clearId) then System.out.println(Forgetting RAISE/CLEAR( + $clearId + )); delete($clear); delete($raise); end On Jul 10, 2014, at 2:50 PM, Kent Anderson kent.ander...@psware.com mailto:kent.ander...@psware.com wrote: The following rule produces a memory leak in Drools 6.1.0-SNAPSHOT: (Stream mode) declare MyEvent @role(event) @timestamp(timestamp) end /* If a RAISE is buffered for N seconds, send it out */ rule forward raise no-loop duration (3s) when $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId) then System.out.println(Forwarding RAISE( + $raiseId + )); delete($raise); end I see the rule fire as expected, printing out the message 3 seconds after the event is added into the session. While the event is waiting, I see a FactCount of 1 in the session. After the rule fires, the fact count goes to 0. However, using JVisualVm, querying the heap dump shows 1 instance of MyEvent, referenced by an EventFactHandle and several other Drools objects. Is this a bug, or is there a better way to write this rule so Drools' internals let go of the object after it is no longer a fact
Re: [rules-users] Workaround: EventFactHandle retained in memory after FactCount reaches 0 for temporal-based rule
Thanks for reporting, we'll investigate both this and 498 Davide On 07/11/2014 08:38 PM, Kent Anderson wrote: We have found a workaround that eliminates the leftover event (gone from Working Memory, but not from the JVM memory): The rule forget it ever happened (seen below) causes the problem. Re-writing it to remove the check for RAISE in the LHS eliminated the memory leak. Of course, our application requires the check for RAISE, so it can be accomplished by manually querying working memory from the RHS. It's ugly, but it resolved the issue. query existsRaise($id) $raise : MyEvent( eventState == EventState.RAISE, eventId == $id ) end ruleprocess clear no-loop when $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId) then QueryResults results = kcontext.getKieRuntime().getQueryResults( existsRaise, $clearId ); if (results.size() == 0) { System.out.println( Forwarding CLEAR( + $clearId + ) ); } else { System.out.println(Forgetting RAISE/CLEAR( + $clearId + )); for (QueryResultsRow row : results){ MyEvent raise = (MyEvent) row.get ($raise); delete(raise); } } delete($clear); end This appears to be a similar situation to https://issues.jboss.org/browse/DROOLS-498. On Jul 10, 2014, at 3:54 PM, Kent Anderson kent.ander...@psware.com mailto:kent.ander...@psware.com wrote: Correction: The original post did not include another rule that exists in the stream. The memory leak does not appear unless both rules are active in the stream. declare MyEvent @role(event) @timestamp(timestamp) end /* If a RAISE is buffered for N seconds, send it out */ ruleforward raise no-loop duration(3s) when $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId) then System.out.println(Forwarding RAISE( + $raiseId + )); delete($raise); end /* When CLEAR, and buffered, clear them both out */ ruleforget it ever happened no-loop when $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId) $raise : MyEvent(eventState == EventState.RAISE, eventId == $clearId) then System.out.println(Forgetting RAISE/CLEAR( + $clearId + )); delete($clear); delete($raise); end On Jul 10, 2014, at 2:50 PM, Kent Anderson kent.ander...@psware.com mailto:kent.ander...@psware.com wrote: The following rule produces a memory leak in Drools 6.1.0-SNAPSHOT: (Stream mode) declare MyEvent @role(event) @timestamp(timestamp) end /* If a RAISE is buffered for N seconds, send it out */ ruleforward raise no-loop duration(3s) when $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId) then System.out.println(Forwarding RAISE( + $raiseId + )); delete($raise); end I see the rule fire as expected, printing out the message 3 seconds after the event is added into the session. While the event is waiting, I see a FactCount of 1 in the session. After the rule fires, the fact count goes to 0. However, using JVisualVm, querying the heap dump shows 1 instance of MyEvent, referenced by an EventFactHandle and several other Drools objects. Is this a bug, or is there a better way to write this rule so Drools' internals let go of the object after it is no longer a fact? PastedGraphic-1.png PastedGraphic-2.png ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] unexpected/spurious ClassCastException
Sorry for not being able to get back to you again earlier. Yes, the rule / query you are showing makes sense - I would have asked you for something similar :) It is definitely a bug in the resolution of the class that defines an attribute, we could really use the reproducer to fix it quickly. I'll check the enabled attribute's behavior in 6.x Thanks Davide On 07/07/2014 06:11 PM, Borris wrote: On Monday 07/07/2014 23:26, Davide Sottara wrote: I'll try to reproduce the exception with the rule and the data model. Meanwhile, could you share a self-contained unit test that reproduces the problem? That would speed up the fix process Thanks! Davide Hmm. Worked out what is happening. The exception is triggered by these: rule handleComplexFoodItemClash enabled false when $first: ContextFoodItem( $item, true; ) $second: ContextFoodItem( this != $item, avoid == false ) isExampleOf( $second, $first; ) then retract($second); end query isExampleOf (FoodItem $subject, FoodItem $category) ( eval($subject == $category) ) or ( BroaderNarrower($broader, $subject;) and ?isExampleOf($broader, $category;) ) end This is the last thing I was playing with, so maybe not surprising there's an error (the exception arises because of the isExampleOf query and is a simple bug for me to fix). BUT BUT BUT I have enabled false as a rule attribute. Am I missing something - I expected this to mean that the when part is never evaluated, but it looks more like the when part is evaluated but consequences are not added to the agenda. The documentation is sufficiently terse that both viewpoints could be argued :( Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] unexpected/spurious ClassCastException
Ok, so there is indeed a problem in the way the query is invoked The input arguments are of type ContextFoodItem, while the formal arguments of the query are FoodItem. The compiler should do a type check (which is probably missing) and report an error at compile time. This throws an exception in the query body, and this is the exception I see when I run your test case. java.lang.RuntimeException: com.sample.Rule_isExampleOf0Eval0Invoker@152d453a : java.lang.ClassCastException: com.sample.ContextFoodItem cannot be cast to com.sample.FoodItem at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:123) at org.drools.core.phreak.PhreakEvalNode.doLeftInserts(PhreakEvalNode.java:55) Actually, the exception you reported initially was Exception in thread main java.lang.ClassCastException: com.tastiereasier.rulez.ContextFoodItem cannot be cast to com.tastiereasier.domain.FoodItem at ConditionEvaluator3754d879fb5b46a3b2cfbe61326ba9f5.evaluate(Unknown Source) at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216) at org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185) at but it probably happens if the second part of the query - the join with the recursive call - is triggered. As for the enabled flag, it does not prevent the evaluation of the LHS. It only disables the actual execution of the RHS. Let me investigate some more Davide On 07/09/2014 11:49 AM, Borris wrote: On Wednesday 09/07/2014 14:41, Davide Sottara wrote: Sorry for not being able to get back to you again earlier. Yes, the rule / query you are showing makes sense - I would have asked you for something similar :) It is definitely a bug in the resolution of the class that defines an attribute, we could really use the reproducer to fix it quickly. I'll check the enabled attribute's behavior in 6.x Thanks Davide I'll tidy up the the test case I've generated and email it to you. Just to be clear, the cast exception was caused by a mistake on my part in the when part of a rule, but in a rule with an enabled false attribute. I had done the standard thing of gradually disabling bits until the error went away, but had not allowed for the exception being triggered with enabled false, so had assumed (not unreasonably I argue :) ) that the initially supplied rules must be the cause of the problem. At least, that's my conclusion - but the test case will let you decide independently. Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] unexpected/spurious ClassCastException
What is the relationship (extends/implements) between the classes/interfaces in your model - ContextFoodItem, FoodItem, ContextDiner, etc.. ? Could you also please specify the version of Drools you are using? Thanks! Davide On 07/07/2014 03:04 PM, Borris wrote: I am getting an unexpected cast exception. The backtrace looks like Exception in thread main java.lang.ClassCastException: com.tastiereasier.rulez.ContextFoodItem cannot be cast to com.tastiereasier.domain.FoodItem at ConditionEvaluatorb792d1e4169f4ac98945e49e1412d793.evaluate(Unknown Source) at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216) at org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185) at org.drools.core.common.SingleNonIndexSkipBetaConstraints.isAllowedCachedLeft(SingleNonIndexSkipBetaConstraints.java:141) at org.drools.core.phreak.PhreakJoinNode.doLeftInserts(PhreakJoinNode.java:98) at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:60) at org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:547) at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:533) at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334) at org.drools.core.phreak.RuleNetworkEvaluator.evalStackEntry(RuleNetworkEvaluator.java:224) at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166) at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116) at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:193) at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:68) at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:928) at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1193) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1202) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1175) at com.tastiereasier.rulez.Rulez.insertAndFire(Rulez.java:168) at com.tastiereasier.rulez.Rulez.addDinerToContext(Rulez.java:310) at com.tastiereasier.rulez.Rulez.init(Rulez.java:101) at com.tastiereasier.rulez.Rulez.main(Rulez.java:44) The rules that are triggering this are: rule contextDinerDislike enabled true when ContextDiner( $diner; ) DatumPreference ( datumPreferenceType == DatumPreference.Type.PREFERENCE, belief.factor 0.0, $datum: datum ) from $diner.getDatumPreferences() then insert( new ContextFoodItem( (FoodItem) $datum, true ) ); end rule spotNewContextDinerLike enabled true when ContextDiner( $diner; ) DatumPreference ( datumPreferenceType == DatumPreference.Type.PREFERENCE, belief.factor 0.0, $datum: datum ) from $diner.getDatumPreferences() then insert( new ContextFoodItem( (FoodItem) $datum, false ) ); end If I disable either rule, then the other proceeds fine and no cast exception happens. I can't see why the cast should ever be asked for - it doesn't make sense. If I changed the boolean parameter in the new in the insert - so both are either true or both are either false, there are no cast exceptions (there must be a clue here). If I put a debug after the insertion, the backtrace actually happens after return from the insert() method - implying it's something on the agenda? I tried using the Audit stuff to see if it gave any clues - but I've never used that before and simply got a heap exhaustion from Eclipse after 1/2 hour trying to ingest something like 200 meg of trace data - I've got a lot of data being initialised into the workspace before these rules get a chance to do anything. It's feeling remarkably like a bug to me, but I don't know how to interpret the backtrace usefully, so it's possible I've got something messed up elsewhere - although I've disabled massive amounts of rules that I can. I grabbed a snapshot last night and it didn't change anything. (I was on a snapshot from early June to fix being able to have Drools editor reference my external jars.) Does this look like a bug or user error? It's going to take some effort to try and extract a test case so I really don't want to spend the effort on that unless it looks the only way. Sage observations most appreciated. Borris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] unexpected/spurious ClassCastException
I'll try to reproduce the exception with the rule and the data model. Meanwhile, could you share a self-contained unit test that reproduces the problem? That would speed up the fix process Thanks! Davide On 07/07/2014 04:24 PM, Borris wrote: On Monday 07/07/2014 23:09, Borris wrote: Hi, Thanks for the response. Version is now 6.1.0.201407061813 (snapshot from last night). Previous version was 6.1.0.201406070605 (snapshot from about a month ago). I was on a snapshot because I wanted the fix for this: https://github.com/droolsjbpm/droolsjbpm-tools/commit/6bc54748e Slight my bad - I'd forgoten to do a new runtime and use that. Fixed. Still get the same issue, but some of the line numbers are slightly different, in case that's relevant. Exception in thread main java.lang.ClassCastException: com.tastiereasier.rulez.ContextFoodItem cannot be cast to com.tastiereasier.domain.FoodItem at ConditionEvaluator3754d879fb5b46a3b2cfbe61326ba9f5.evaluate(Unknown Source) at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216) at org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185) at org.drools.core.common.SingleNonIndexSkipBetaConstraints.isAllowedCachedLeft(SingleNonIndexSkipBetaConstraints.java:141) at org.drools.core.phreak.PhreakJoinNode.doLeftInserts(PhreakJoinNode.java:98) at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:60) at org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:547) at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:533) at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334) at org.drools.core.phreak.RuleNetworkEvaluator.evalStackEntry(RuleNetworkEvaluator.java:224) at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166) at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116) at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216) at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91) at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964) at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1212) at com.tastiereasier.rulez.Rulez.insertAndFire(Rulez.java:168) at com.tastiereasier.rulez.Rulez.addDinerToContext(Rulez.java:310) at com.tastiereasier.rulez.Rulez.init(Rulez.java:101) at com.tastiereasier.rulez.Rulez.main(Rulez.java:44) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Unable to resolve class error , drools 5.5 in concurrent execution. JSR94Support and Spring
5.5 was not thread-safe and some of these concurrency issues have been fixed in later versions. Could you try 5.6 or 6.x? On 07/02/2014 08:19 AM, maruthi_s wrote: Hi , We use Drools 5.5 and drool implementation is done through Spring JSR94Support API The Rule engine is called in concurrent mode, i.e , JSR94Support.executeStateless(name,list) is executed through multiple threads. And when the rules are executed we randomly get the following exception org.drools.RuntimeDroolsException: Unable to resolve class 'someclass(this is sample)here actual class is printed' at org.drools.base.ClassFieldAccessorCache.getClass(ClassFieldAccessorCache.java:126) at org.drools.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:48) at org.drools.reteoo.ClassObjectTypeConf.init(ClassObjectTypeConf.java:83) at org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:159) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847) at org.drools.reteoo.ReteooStatelessSession.executeWithResults(ReteooStatelessSession.java:273) The rules are registered every 15 minutes through RuleAdministrator.registerRuleExecutionset , so whenever we refresh the rules and the subsequent thread even after the registration is completed, fails with the above message. This happens only when the rules are invoked concurrently. Please advise. -- View this message in context: http://drools.46999.n3.nabble.com/Unable-to-resolve-class-error-drools-5-5-in-concurrent-execution-JSR94Support-and-Spring-tp4030226.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] accumulate function not registered
can you please open a jira ticket and possibly add a reproducer? It seems a serious regression, but it would have to be reproduced and fixed in the next few days for this to make it to the final release Thanks! Davide On 06/18/2014 03:26 PM, rogerL wrote: After upgrade to 6.1.0.CR1 rule compilation is generating a pluggable accumulate function registration error. Partial stack dump: Caused by: java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=com/s/c/manager/rules/campaign/priority/prioritize.drl, line=31, column=0 text=Unknown accumulate function: 'topPriority' on rule 'Insert highest priority campaign'. All accumulate functions must be registered before building a resource.], Message [id=2, level=ERROR, path=com/s/c/manager/rules/campaign/priority/prioritize.drl, line=31, column=0 text=Rule Compilation error $tc cannot be resolved to a variable]] The associated rule and accumulate import are: import accumulate com.s.c.util.HighestPriorityCampaignAccumulateFunction topPriority; rule Insert highest priority campaign when not TopCampaign() accumulate(TargetCampaigns($list : list, list.size 0), $tc : topPriority( $list ) ) then insert(new TopCampaign($tc)); end Is this syntax no longer correct? -- View this message in context: http://drools.46999.n3.nabble.com/accumulate-function-not-registered-tp4030102.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Adding eval on rule cause it to run in infinite loop
The whole point of @propertyReactive is to avoid no-loop where possible. What Wolfgang was trying to say is that there is no need to use the eval: just write DvFacts0( condIsNUMERIC == null ) and the @propertyReactivity will work Davide On 06/11/2014 10:40 AM, brachi wrote: so, will no-loop help? is eval also override this attribute? -- View this message in context: http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029971.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Adding eval on rule cause it to run in infinite loop
Could you please show the conditions for which you need the eval? And which version are you using? As far as I know, eval is rewritten and removed internally in latest versions, so there shouldn't be a difference. On 06/11/2014 12:34 PM, brachi wrote: I need the eval. I have some rules that doesn't hit correctly, just if I put eval around the condition. but eval makes the rules to run in an infinite loop. -- View this message in context: http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029979.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Adding eval on rule cause it to run in infinite loop
I think I know what is happening here. I assume your supportFT class is @propertyReactive. (btw, you should follow bean conventions and capitalize class names) Looking at Rule 1, you don't set the value directly, but you do it through a modify. Your rule 2, which checks for the value, uses the function containsAny rather than the field direclty as in value IN (..). At the moment, the engine has no way to realize that the function involves the field value - I'm not even sure it is possible in general - Property reactivity will ignore the update since, from its perspective, none of the fields relevant to the rule has been affected, hence rule 2 will not hit. If you use eval in the constraint, property reactivity is disabled, so the rule WILL fire the first time, but now you are vulnerable to infinite loops, as if you did not have propertyreactive. You may have to use the @watch() annotation explicitly to control which modifies will cause reevaluations and which ones won't (see the manual for this) Adding eval everywhere is not a good idea. Best, Davide On 06/11/2014 01:53 PM, brachi wrote: example of rule that doesn't work without eval: /*rule 1 salience -1 agenda-group agenda1 when $conclusion: supportFT() then if($conclusion.getValue()==null){ modify($conclusion) { setValue(new ArrayList())}; } $conclusion.getValue().add(supportedValue); modify($conclusion) { setValue($conclusion.getValue()) }; end rule 2 salience -2 agenda-group agenda2 when supportFT(Operators.containsAny(value,new String[]{supportedValue,otherValue})) $conclusion: ConclusionFt() then modify($conclusion){setValue(success)}; end*/ rule 2 doesn't hit, works only with eval in rule 2. in this example I can add eval, because the Fact Types model is different, so the rule doesn't reevaluated. because I had this case, I decided to add eval for all constraints, but unfortunately I had an infinite loop. -- View this message in context: http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029984.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Are there second-rate fact types?
java.util.Collections (and descendants) are not @typesafe by default, I'll check the reason for that. More generally, if a fact is declared as not @typesafe, the runtime failure should be more graceful. Davide On 06/10/2014 01:26 PM, Wolfgang Laun wrote: Consider: class Foo { /*...*/ } rule checkFoo when Foo( noSuchField 0 ) then ... end DRL compilation reports an error (Error: unable to resolve method ...) and identifies rule, line and column, which is fine. Now let's look at: import java.util.ArrayList; rule checkArrayList when ArrayList( noSuchField 0 ) then ... end The same DRL compiler (checked with 5.5.0 and 6.0.0) accepts this, and there is a nasty exception thrown at runtime. This is inconvenient, since the exception can be thrown by any code inserting an ArrayList object, and the faulty rule isn't identified. Why are certain classes second-rate? -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Are there second-rate fact types?
In fact what we have now is *NOT* graceful I'll open a JIRA and try to provide a fix On 06/10/2014 01:52 PM, Wolfgang Laun wrote: On 10/06/2014, Davide Sottara dso...@gmail.com wrote: java.util.Collections (and descendants) are not @typesafe by default, I'll check the reason for that. OK. More generally, if a fact is declared as not @typesafe, the runtime failure should be more graceful. But (according to you) java.util.Collections is *not* @typesafe, and this runtime failure cannot be called graceful. Can a java.util.X be declared as @typesafe? If so, how? Is any of this documented anywhere? -W Davide On 06/10/2014 01:26 PM, Wolfgang Laun wrote: Consider: class Foo { /*...*/ } rule checkFoo when Foo( noSuchField 0 ) then ... end DRL compilation reports an error (Error: unable to resolve method ...) and identifies rule, line and column, which is fine. Now let's look at: import java.util.ArrayList; rule checkArrayList when ArrayList( noSuchField 0 ) then ... end The same DRL compiler (checked with 5.5.0 and 6.0.0) accepts this, and there is a nasty exception thrown at runtime. This is inconvenient, since the exception can be thrown by any code inserting an ArrayList object, and the faulty rule isn't identified. Why are certain classes second-rate? -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users . ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Abstraction between rules and data model?
I can't guarantee a public date.. as a community member, I work on a best effort basis... I'll try to do it before the end of the month, though. For now, as a workaround, I would create derived getter/setter pairs that expose the desired computations. A concrete example of what you are trying to do exactly would also be helpful, feel free to contact me privately if you can't share your code here Best Davide On 05/28/2014 10:08 AM, Péter Gergely, Horváth wrote: Thanks for the explanation, I was a bit confused because of the terminology; virtual is not mentioned in the docs. ;) Is there any plan for the public release of Trait property binding to a nested path? We would definitely need something like that in our environment. Or do you see any way we could hook into the property look-up mechanism? Based on what I know, I don't see any official extension point for that. My only idea would be using some Java proxy voodoo-magic to wrap objects before they are inserted to the session, but my gut feeling is that it would be a way to debug hell... What do you think? Cheers, Peter 2014-05-27 19:42 GMT+02:00 Davide Sottara dso...@gmail.com mailto:dso...@gmail.com: Consider that a trait is an interface applied to some class. In the context of the pair: A hard field is a property (get/set) exposed by the interface AND the underlying class A soft (or virtual) field is a property exposed by the interface BUT NOT by the underlying class A hidden field is a field of the underlying class NOT exposed by the interface Hard and Soft fields can be accessed using the interface, hidden fields are accessible using the map-like construct fields[ fieldName ]. This said, the mapping is by default done using the property name and (then) the property type. However, this mapping can be decoupled using the annotation @Alias() on either the class OR the trait. E.g. declare Core name : String @Alias( any-Id-or-even-an-IRI-here ) end declare trait SomeTrait label : String @Alias( ... ) // if two aliases match, this will be considered a hard field end The accessor, i.e. the ability to bind a trait property to a (possibly deeply) nested path is what I'm working on these days, I have the same requirement from another urgent use case For the time being, you can probably create a shortcut accessor pair in your implementation class, to execute the complex expression, and @Alias it to the trait field. Please let me know if you find any issue/bugs and any feature request you may have! Best Davide On 05/27/2014 07:57 AM, Horváth Péter Gergely wrote: Hi Davide, Drools trait functionality is one of the powerful concepts which makes Drools a good candidate for the project. So keep up the good work! :) However I'm not sure if its current level of flexibility would be sufficient for our use case. I've checked the documentation, but haven't really found the term virtual field -- could you please elaborate on this? Do you think we could somehow hook into the evaluation of the aliases or the fields Map? Sometimes you would need slightly more than merely aliasing fields to something else; e.g. calculating values for the purpose of rule processing or extracting a value from a more complex object tree etc. Citing the example -- GoldenCustomer( fields[ age ] 18 ) -- being able to get a reference to the target object and the field map expression age would be quite close to what I imagined. Our custom code could then perform the appropriate translation and return the requested value, hiding the fact whether age is an actual field in the Customer object itself/retrieved from an encapsulated complex object e.g. replacing expression customer.personalInformation.birthData.age/calculated on the flight. What do you think? Cheers, Peter 2014-05-26 17:58 GMT+02:00 Davide Sottara dso...@gmail.com mailto:dso...@gmail.com: We are working on the trait framework for cases like this. Essentially, it allows to use interfaces when writing rules AND to inject the interfaces dynamically at runtime, at the instance level. It relies on transparent proxies which wrap the data classes and implement the required interfaces. A simple field aliasing mechanism is provided (work in progress). For more complex transformations, virtual fields can be added. See section 7.7.8 of the manual for more details and let me know if it can help with your use case. Best, Davide On 05/26/2014 09:55 AM, Wolfgang Laun wrote: Even
Re: [rules-users] Not and forall operator behaviour
Both should fire when there is no message. This said, the two are not equivalent. The negation of Message( sent == true, status != INITIALIZED ) is: Message( sent == false *||* status == INITIALIZED ) That is, by deMorgan's laws, you need to negate the operators AND flip the and/or connectives. In case something still seems weird, could you please specify the drools version you're using, as well as which facts you are inserting exactly? Thanks Davide On 05/29/2014 09:33 PM, rogerL wrote: Are the two following statements not equivalent? forall($msg:Message() Message(this==$msg, sent==true, status!=State._INITIALIZED) ) not( Message(sent==false, status==State._INITIALIZED) ) My understanding is that they both ensure that there are no Message objects in WM with property 'sent' set to false and property 'status' set to State._INITIALIZED. In my situation, the 'forall' approach is working as expected, the 'not' approach fires once (when there are no Message objects in WM) and never again. Appreciate if anyone could shed light on this. -- View this message in context: http://drools.46999.n3.nabble.com/Not-and-forall-operator-behaviour-tp4029761.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Abstraction between rules and data model?
We are working on the trait framework for cases like this. Essentially, it allows to use interfaces when writing rules AND to inject the interfaces dynamically at runtime, at the instance level. It relies on transparent proxies which wrap the data classes and implement the required interfaces. A simple field aliasing mechanism is provided (work in progress). For more complex transformations, virtual fields can be added. See section 7.7.8 of the manual for more details and let me know if it can help with your use case. Best, Davide On 05/26/2014 09:55 AM, Wolfgang Laun wrote: Even a relatively sophisticated transformation would be easier to implement and most certainly safer from changes in the unstable Drools API than some hook-and-intercept mechanism built into Drools. Notice that violent structural departure of the model the BUs see from what you call persistence model might make it impossible for the BUs to come up with rules that can be transformed to match the other model at all; if it is possible, rules might still incur a heavy performance penalty. It is (IMHO) a myth that Rules is a foolproof way of establishing business logic independent from the data model and application environment with which this logic should be able to cooperate. As long as everything is kept in the abstract (i.e., formulated in terms of mathematics) it will look good, but any implementation may throw a spanner in the works, or worse. -W On 26/05/2014, Péter Gergely, Horváth h.pe...@mailbox.hu wrote: Hi Wolfgang, Thank you for your input. You are right that some of the cases could simply be covered by regexp-replace, but I'm afraid, not all of them. Interfaces could also help, but we have a requirement that the business rules should not be tightly coupled to the underlying persistence model. (I understand that some might say this is not ideal, but that is our current situation) I am wondering whether it is possible to hook into Drools engine and intercept field value reference expression evaluations in run time (e.g if foo.bars is used in an expression, we could return foo.barList) ? By injecting some custom code, we could make the necessary decisions and extract the proper value from an object. Unfortunately these parts of Drools are pretty much undocumented. Regards, Peter 2014-05-26 13:57 GMT+02:00 Wolfgang Laun wolfgang.l...@gmail.com: What you describe can be done with /bin/sed. Notice that the DSL processor doesn't require you to translate entire patterns; there is a mechanism for translating keywords, which is just arbitrary tokens to whatever replacement text. If a bar must be translated to a barList in the context of a class Foo but not in any other context, a more sophisticated translation is required in any case (with /bin/sed still being sufficient if patterns aren't split across lines). Some say that good design makes use of Interfaces, which leaves room for actual implementations being changed as long as the interfaces are implemented. Here, note that rules can be written against interface types. -W On 26/05/2014, Péter Gergely, Horváth h.pe...@mailbox.hu wrote: Hi All, We are evaluating Drools 6 for our use case, and face challenges where we would need some ideas from more experienced users of Drools. We have an application with a massive code base and a large number of model (entity) classes. We are in the process of moving away from inherited legacy technologies and refactoring the old code base. As a part of this work we would like extract some of the hard-coded business logic to external rules, that is why we are looking at Drools as a potential solution. What we would like to have is some kind of abstraction or mapping between actual entities and rules the business users can define so that they do not have to know the _exact_ details of the data model (field names, precise relations etc). This would be important for us so that we can refactor the old model classes without affecting business rules; also it would make life easier for the business users. While IDE support might make refactoring easier, we definitely want to have a separation between rules and entities. Given our situation, writing and maintaining stable wrapper/adapter classes for the sole purpose of rule processing is out of question. I have checked the documentation of Drools DSL support and for me it seems to be overkill for our use case: we do not really need a custom language, but simply an abstraction between rules and the data model classes. What I could imagine is a piece of code, (a custom property resolver? - no sure how it is called) which maps property expressions to actual properties based on a custom annotation on the entity class or something like that, so that a rule containing Foo.bars expression does not have to change even if we decide to rename Foo.bars to Foo.barList in the model classes. (This was just a simple
Re: [rules-users] java.lang.VerifyError org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V
You mean that it used to work with your combination (jboss 4.2 + drools 5.4.0) and then it suddenly started throwing the exception? It seems strange.. do you have other applications deployed on the same instance of jboss? Maybe it's picking up a different version of the jars from somewhere else Davide On 05/26/2014 10:10 AM, ivonne wrote: Hi I am using jboss 4.2 and drools core 5.4.0.Final. The application was working fine but without any change it started to throw an error when spring bean for kbase is created. This is the error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kbase': Invocation of init method failed; nested exception is java.lang.VerifyError: (class: org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V) Incompatible argument to function If I run the application using jetty it works fine. I've been looking about the error with any sucess. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Cannot issue fireUntilHalt when using persisted session
Could you please show the code where you persist, reload and invoke fireUntilHalt() on the session? Ideally, could you open a jira ticket and post the code there? We'll take a look then. Thanks Davide On 05/22/2014 01:43 PM, rogerL wrote: Due to an issue with reloading persisted sessions that contained a cron timer rule, I upgraded to 6.1.0.Beta3. Now I'm encountering a problem with a threaded fireUntilHalt command (cannot be issued on a persisted session). Exception in thread SimpleAsyncTaskExecutor-1 java.lang.UnsupportedOperationException: Command session.fireUntilHalt(); cannot be issued on a persisted session at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:474) at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.fireUntilHalt(CommandBasedStatefulKnowledgeSession.java:272)... It worked without issue in 6.0.1.Final. Though I suspect not, is this expected behaviour? Alternately, are there configuration/other changes that must be implemented. Libs spring 4.0.1 kie, drools, jbpm 6.1.0.Beta3 hibernate 4.3.4 -- View this message in context: http://drools.46999.n3.nabble.com/Cannot-issue-fireUntilHalt-when-using-persisted-session-tp4029656.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.VerifyError org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V
I can't tell for sure... 5.4.0 is relatively old, and there is not much that can be done with the released jars. I suspect that you had some duplicate, incompatible classes on the classpath (having BOTH drools-all and the others seems suspicious), and the classloader was 'almost always' picking up the one that made it work. Out of pure luck. Davide On 05/26/2014 11:45 AM, Ivo Escamilla wrote: Thanks for your answer. It is the unique application in the server. The server is on my local. Right, it was working fine and then started throwing the exception. In the pom I had drools-core, drools-spring and drools-all-jdk5 version 5.4.0.Final. I deleted all and use only drools- spring 5.4.0.Final and I solve the issue. I don't know why it works. I tried many things like new versions, deleted from my local and installed them again, with any success. It works using jetty but not with jboss. But using only that dependency fixed the issue. Do you know why? El may 26, 2014 11:02 AM, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com escribió: You mean that it used to work with your combination (jboss 4.2 + drools 5.4.0) and then it suddenly started throwing the exception? It seems strange.. do you have other applications deployed on the same instance of jboss? Maybe it's picking up a different version of the jars from somewhere else Davide On 05/26/2014 10:10 AM, ivonne wrote: Hi I am using jboss 4.2 and drools core 5.4.0.Final. The application was working fine but without any change it started to throw an error when spring bean for kbase is created. This is the error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kbase': Invocation of init method failed; nested exception is java.lang.VerifyError: (class: org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V) Incompatible argument to function If I run the application using jetty it works fine. I've been looking about the error with any sucess. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4029698i=0 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4029698i=1 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694p4029698.html To unsubscribe from java.lang.VerifyError org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V, click here http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4029694code=aXZvbml2b25uZUBnbWFpbC5jb218NDAyOTY5NHw4MzAzODY1Mg==. NAML http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is @PropertySpecific supported in Drools 5.6.0
In the end it was actually named @PropertyReactive On 05/21/2014 12:38 AM, RavishankarHassain wrote: I was looking fro some examples and document which explains on how to use the @Modifies annotations inside Facts(Java class) and it happened for me to see this doc http://docs.jboss.org/drools/release/5.4.0.Beta2/droolsjbpm-introduction-docs/html/releaseNotesBeta2.html I tired to implement @PropertySpecific and @Modifies according to the session 3.1.2.1. Fine Grained Property Change Listeners (Property Specific) which is briefly described in the above mentioned link But, when I tried to use @PropertySpecific annotation in my Facts(java class) Eclipse IDE is not able to identify or resolve the package for @PropertySpecific annotation. I am using Drools 5.6.0. Is this @PropertySpecific annotation still supported in Drools, if yes then where is it ? in which package and in which jar ? -- View this message in context: http://drools.46999.n3.nabble.com/Is-PropertySpecific-supported-in-Drools-5-6-0-tp4029633.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is property reactive bug in 5.5 fixed in 6.0
Bugs about @PR were reported and fixed in 5.6 and 6.x The fixes cover the bug described in the original thread. More issues related with @PR were fixed here: https://issues.jboss.org/browse/DROOLS-91?jql=project%20%3D%20DROOLS%20AND%20text%20~%20%22property%20reactive%22 If you have encountered a specific problem with one of your rules, please report it. Thanks Davide On 05/04/2014 04:34 PM, wtang wrote: if you please could click on the link on the original post, you will see it has Mark Proctor name on it and you were pushing for a fix in future release of 5.5. Please let me know if this bug have been fixed in 6.0. thx, Wing -- View this message in context: http://drools.46999.n3.nabble.com/Is-property-reactive-bug-in-5-5-fixed-in-6-0-tp4029419p4029421.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Guvnor 5.3.0 crashing OOM JoinNodeLeftTuple
This is unlikely a problem of the guided editor. Tuples are created when you run the rules in a session. We'd need to know which rules you're running and how you are inserting/retracting facts. Best Davide On 05/01/2014 01:57 PM, Jens Alejos at OAK CORP x4287 wrote: Hello, Our Guvnor 5.3.0 is generating an OOM and crashing the server. At the time of the crash we could see lots objects holding a lot of stuff in memory, most notably 23,878,166 org.drools.reteoo.JoinNodeLeftTuple, each of which takes 72 bytes. For 1.7 GB of heap. I believe the real issue is something is going wrong in guvnor that it is creating way to many of these org.drools.reteoo.JoinNodeLeftTuple objects. Do you guys have had this issue? Is this because of a Guvnor guided editor bug? Thanks NOTICE: This message, including any attachments, is intended for the use of the party to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately by reply e-mail, and delete the original and any copies of this message. It is the sole responsibility of the recipient to ensure that this message and any attachments are virus free. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Question about length windows
On 05/01/2014 09:46 PM, Wolfgang Laun wrote: A window:length is filled depending on the constraints but independent of how old the participating facts are. Currently only ALPHA constraints determine which facts are filtered by a length window. There is a JIRA to include beta constraints, but it has not yet been discussed. So yes, if none of your facts had value 102.352, it is possible for (26) to be still in the window when (146) comes in. Davide What you want to achieve can be done without windows: t2_1 : Tick( value 102.352 ) t1_1 : Tick( this before t2_1 , value = 102.352 ) not Tick( this before t2_1 after t1_1 ) The last pattern ascertains that the preceding pair of facts is adjacent. (The three timestamps should be different.) You can also use rules based on an auxiliary fact maintaining state: While value 102.352, state is set to below; as soon as a fact with value = 102.352 matches state == below, the threshold is passed and state is set to above... -W On 02/05/2014, Demian Calcaprina calcacue...@gmail.com wrote: Hi Guys, I have one question about how lenght windows will work. I have a rule like this. Basically, it is a crosses function, where the value of my object crosses a value. rule mytest dialect mvel when t2_1 : Tick( value 102.352 ) over window:length (1) t1_1 : Tick( this before t2_1 , value = 102.352 ) over window:length (2) then //DO SOMETHING end 23:51:32,150 INFO [org.drools.core.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #2 - JmsConsumer[]) ACTIVATION FIRED rule:mytest activationId:berarrr_1 [0, 27, 26] declarations: t2_1=Tick [value=102.351, tickTime=Fri May 02 05:51:31 ART 2014](27); t1_1=Tick [value=102.352, tickTime=Fri May 02 05:51:12 ART 2014](26) 23:53:30,560 INFO [org.drools.core.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #2 - JmsConsumer[]) ACTIVATION CREATED rule:mytest activationId:berarrr_1 [0, 146, 26] declarations: t2_1=Tick [value=102.349, tickTime=Fri May 02 05:53:30 ART 2014](146); t1_1=Tick [value=102.352, tickTime=Fri May 02 05:51:12 ART 2014](26) If you see, the first activation, the window:length(1), matched the object 27 window:length(2), matched the object 26 Then, after 2 minutes and some Ticks insertes in the WM window:length(1), matched the object 146 but window:length(2), still matched the object 26 I would expect, that, as object 26 was the first one to be inserted, then it is outside the window:length(2). Is my understanding correct? Am I making something wrong? I am using Drools 6. Thanks! Demian ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.VerifyError: Bad type on operand stack
Looks like a bug.. can you post the DRL that generates this error? On 04/15/2014 09:12 AM, lvtenorio wrote: Hello, I am writing a rules file and unit tests to test each one of them. I am getting this error during the execution java.lang.VerifyError: Bad type on operand stack Exception Details: Location: ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d.evaluate(Lorg/drools/core/common/InternalFactHandle;Lorg/drools/core/common/InternalWorkingMemory;Lorg/dr ools/core/reteoo/LeftTuple;)Z @12: ireturn Reason: Type 'java/lang/Boolean' (current frame, stack[0]) is not assignable to integer Current Frame: bci: @12 flags: { } locals: { 'ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d', 'org/drools/core/common/InternalFactHandle', 'org/drools/core/common/InternalWorkingMemory', 'org/drools/core/reteoo/LeftTuple' } stack: { 'java/lang/Boolean' } Bytecode: 000: 2bb9 001b 0100 c000 1db6 0021 ac at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) at java.lang.Class.getConstructor0(Class.java:2803) at java.lang.Class.getConstructor(Class.java:1718) at org.drools.core.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:197) at org.drools.core.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:55) at org.drools.core.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:289) at org.drools.core.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:53) at org.drools.core.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) The tests don't stop running and keep working. Here is my pom in case it helps project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; modelVersion4.0.0/modelVersion groupIdDroolsTest/groupId artifactIdDroolsTest/artifactId version1.0-SNAPSHOT/version dependencies dependency groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jxr-plugin/artifactId version2.4/version /dependency dependency groupIdorg.codehaus.groovy/groupId artifactIdgroovy-eclipse-batch/artifactId version2.1.8-01/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-compiler/artifactId version6.1.0.Beta1/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-core/artifactId version6.1.0.Beta1/version /dependency dependency groupIdorg.drools/groupId artifactIdknowledge-api/artifactId version6.1.0.Beta1/version /dependency dependency groupIdjoda-time/groupId artifactIdjoda-time/artifactId version2.3/version /dependency dependency groupIdcommons-lang/groupId artifactIdcommons-lang/artifactId version2.6/version /dependency dependency groupIdorg.slf4j/groupId artifactIdslf4j-api/artifactId version1.7.6/version /dependency dependency groupIdorg.slf4j/groupId artifactIdslf4j-log4j12/artifactId version1.7.6/version /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.7/version /dependency dependency groupIdorg.codehaus.gmaven.runtime/groupId artifactIdgmaven-runtime-1.6/artifactId version1.5/version /dependency /dependencies build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.1/version configuration source1.7/source target1.7/target /configuration /plugin plugin artifactIdmaven-surefire-plugin/artifactId version2.9/version configuration redirectTestOutputToFilefalse/redirectTestOutputToFile
Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue
Ok, perfect. That internal interface was indeed changed. Please note that there is a potential problem with the implementation of the custom evaluators in 5.6. It has been fixed in 6.x, but it should probably be backported. Let me know if you have problems. Davide On 04/14/2014 08:29 AM, Cwen wrote: Davide, please ignore my last post. I looked into the code more and it's the interface changes Evaluator cause the errors. evaluate() methods now have InternalFactHandle as an argument instead of Object. Let me work on those and I will update with you if I see more problems. Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029247.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue
Are you downloading a compiled PKG resource? You'd have to rebuild the PKG with 5.6, or use the source DRL.. On 04/14/2014 11:08 AM, Cwen wrote: Davide, I tried change our methods signature and run the application. Getting following stack trace when calling KnowledgeAgent.applyChangeSet(Resource resource): java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:796) at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1094) at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:844) at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:684) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:207) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:186) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1004) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:957) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4350) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4816) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1028) at
Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue
MVEL glitch, try size() 0 On 04/14/2014 11:59 AM, Cwen wrote: Thank you Davide. That helped. I re-compiled the pkg and it got loaded successfully. However the run execution is throwing the following errors. I am looking into it. Not sure if that's something you have any insight. [Error: could not access: size; in class: java.util.ArrayList] [Near : {... size 0 }] ^ [Line: 1, Column: 1] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:683) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:465) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:370) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140) at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115) at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:114) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86) at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119) at org.mvel2.MVEL.executeExpression(MVEL.java:930) at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:73) at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:52) at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:218) at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:175) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:655) at org.drools.reteoo.AccumulateNode.assertLeftTuple(AccumulateNode.java:185) at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232) at org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:116) at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:151) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:364) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:302) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:254) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:366) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:327) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:950) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:894) at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269) -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029253.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue
Strange.. the APIs should have not changed between 5.5 and 5.6... what kind of compilation errors are you getting exactly? 1) The KA was partially rewritten because of a sub-project (drools-mas), so it was a combination of fixes and natural evolution You can try the tickets here, however: https://issues.jboss.org/browse/DROOLS-273?jql=text%20~%20%22KnowledgeAgent%22%20AND%20project%3DDrools 2) The easiest thing to try would be to replace the 5.5 KA with the 5.6 and recompile + test.. Next week I may have some time to assist you Best Davide On 04/12/2014 05:30 AM, Cwen wrote: Thank you for your advice Davide! I actually tried upgrade to 5.6.0.final. However there were a lot of compile errors from our system. So it's not easy for us to upgrade. I have couple of questions: 1. Is this a known issue documented and fixed with 5.6.0.final? Is there a JIRA ticket tracking this? 2. Is it possible to patch 5.5.0 version with the fixes? Thank you! -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029223.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue
Can you try 5.6.0.Final? Many issues regarding the KnowledgeAgent were fixed in that version Thanks Davide On 04/11/2014 08:45 PM, Cwen wrote: View this message in context: Re: KnowledgeAgentImpl registeredResourceMap memory issue http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029217.html Sent from the Drools: User forum mailing list archive http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Linkage Error In execute method
Can you upgrade to 5.6? Otherwise, you'll have to synchronize the methods int ClassLoader, the null check is not enough On 04/04/2014 09:16 PM, Karan Malhotra wrote: Hi All, We have recently upgraded our application from 5.1.0 to 5.4.0.Final. Everything worked well until this was deployed at Production Envr. We started getting multiple Linkage Error in execute method of Stateless KnowledgeSession. StackTrace: Exception: java.util.concurrent.ExecutionException: java.lang.LinkageError: loader (instance oforg/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attemptedduplicate class definition for name: OffBarCapping/Rule_Off_Bar_Tariff_Capping_13_2a4a909def69414bbd60cdfdac9ad807| OffBarCapping/Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1f# at OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0InvokerGenerated.evaluate(Unknown Source)#at OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0Invoker.evaluate(Unknown Source)# at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:299)# at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)# at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)# at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)# at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)# at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)# at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)# at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)# at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)# at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)# at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)# at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:294)# 1.Some surfing on the internet referred us to a similar JIRA issue:- JBRULES-3675 https://issues.jboss.org/browse/JBRULES-3675 It says this has been fixed in 6.0.0. We were not in a position to upgrade to 6.0.0 right away and hence decide to apply a patch in drools-core-5.4.0.Final.jar Drools: 5.4.0 public Class? More ...fastFindClass( final String name ) { Class? cls = findLoadedClass( name ); if (cls == null) { final byte[] clazzBytes = this.store.read( convertClassToResourcePath( name ) ); if (clazzBytes != null) { String pkgName = name.substring( 0, name.lastIndexOf( '.' ) ); if (getPackage( pkgName ) == null) { definePackage( pkgName, , , , , , , null ); } cls = defineClass( name, clazzBytes, 0, clazzBytes.length, PROTECTION_DOMAIN ); } if (cls != null) { resolveClass( cls ); } } return cls; } Path applied:- public Class fastFindClass(String name) { Class cls = findLoadedClass(name); if(cls == null) { byte clazzBytes[] = store.read(JavaDialectRuntimeData.convertClassToResourcePath(name)); if(clazzBytes != null) { String pkgName = name.substring(0, name.lastIndexOf('.')); if(!existingPackages.contains(pkgName)) { synchronized(this) { if(!existingPackages.contains(pkgName)) { if(getPackage(pkgName) == null) { definePackage(pkgName, , , , , , , null); } existingPackages.add(pkgName); } } } cls = defineClass(name, clazzBytes, 0, clazzBytes.length, JavaDialectRuntimeData.access$000()); } if(cls != null) { resolveClass(cls);
Re: [rules-users] Linkage Error In execute method
You should look at the 5.6 series, not the 6.0. Too many things have changed in the latter -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Linkage-Error-In-execute-method-tp4029123p4029130.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory leak due CompositeClassLoader
I think I'm starting to see the problem now. Where does this component live exactly, and how is that (and the KB) shared between your different webapps? -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Memory-leak-due-CompositeClassLoader-tp4029053p4029131.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory leak due CompositeClassLoader
You may have to dispose the sessions explicitly - or even the knowledgebase, using the internal method that was added as a temporary brute force patch to leaks in 5.6. The composite classloader was replaced in 6.x, so the newer versions should not have this kind of problems. Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Memory-leak-due-CompositeClassLoader-tp4029053p4029100.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Programmatically load rules classloader NullPointerException
Can you try 6.1.0-SNAPSHOT? I tried your code quickly and it seems to work Davide On 03/20/2014 03:25 PM, GrantWang wrote: Would someone please help with this? Did I do something wrong or is this a bug? I am using 6.0.1. Thanks! -- View this message in context: http://drools.46999.n3.nabble.com/Programmatically-load-rules-classloader-NullPointerException-tp4028783p4028827.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgentImpl memory leak (5.5.0.Final)
Can you try version 5.6? On 03/19/2014 05:27 PM, alineasol wrote: Hello, We have a KnowledgeAgent with this configuration: * drools.resource.scanner.interval = 900 * drools.agent.monitorChangeSetEvents = true * drools.agent.scanResources = true * drools.agent.scanDirectories = true * drools.agent.newInstance = false * drools.resource.urlcache = /path/cache We have noticed a memory leak in the class KnowledgeAgentImpl when the resources are down. The KnowledgeAgentImpl begins to reload from cache all the resources every scanner interval they are not reachable. The KnowledgeAgentImpl object increases its size every loop causing a Java Perm Gen error. We use: * drools release 5.5.0.Final * jdk1.6.0_45 * apache tomcat 7.0.42 Any suggestion? Thank you. -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] problem in sliding window
All the context of a session, including the windows, goes away when the session is disposed. In general, please try to post all your DRL and as much information you can on how the sessions are built and managed. That makes it easier to understand what is going on. Thanks! On 03/18/2014 07:20 AM, Sandhya Sree wrote: no, actually i think the problem is because, i create a new session once in 10 seconds and dispose it off. so when i create the first two files in first 10 seconds , the session is disposed, and in the next session the next two files are created and disposed.. like this it goes.. so when i create more than 4 files all at the same instant it falls under the same session and the sliding window works.. could this be the problem? On Mon, Mar 17, 2014 at 5:28 PM, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: It is possible to declare sliding windows A possible problem (I didn't check the logic) is that you are not inserting the new Events you create. On 03/17/2014 12:13 PM, Sandhya Sree wrote: i found this type of declaration in a site and thought this is allowed.. also it doesnt throw any compilation error and works the same way as declared like this: accumulate( $e :Event (name == new file added) *over window : time(1m)*, count($e) On Mon, Mar 17, 2014 at 4:23 PM, Wolfgang Laun wolfgang.l...@gmail.com mailto:wolfgang.l...@gmail.com wrote: On 17/03/2014, Sandhya Sree sandhyachinna...@gmail.com mailto:sandhyachinna...@gmail.com wrote: declare window Ticks Event() over window:time(1m ) end Is there any documentation snippet that says you can declare a fact (not even an event) like this, restricting its existence? If not, why does this not cause an compilation error? -W ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] problem in sliding window
It is possible to declare sliding windows A possible problem (I didn't check the logic) is that you are not inserting the new Events you create. On 03/17/2014 12:13 PM, Sandhya Sree wrote: i found this type of declaration in a site and thought this is allowed.. also it doesnt throw any compilation error and works the same way as declared like this: accumulate( $e :Event (name == new file added) *over window : time(1m)*, count($e) On Mon, Mar 17, 2014 at 4:23 PM, Wolfgang Laun wolfgang.l...@gmail.com mailto:wolfgang.l...@gmail.com wrote: On 17/03/2014, Sandhya Sree sandhyachinna...@gmail.com mailto:sandhyachinna...@gmail.com wrote: declare window Ticks Event() over window:time(1m ) end Is there any documentation snippet that says you can declare a fact (not even an event) like this, restricting its existence? If not, why does this not cause an compilation error? -W ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] IllegalStateException:
Raj, thanks, I think I see what happens. I'll get back to you later! Davide On 03/15/2014 08:04 AM, Raja Sekhar wrote: Hi Davide/Wolfgang The problem is resolved by establishing the session from Kiebase KieContainer kc = KieServices.Factory.get().getKieClasspathContainer(); KieBaseConfiguration conf =KieServices.Factory.get().newKieBaseConfiguration(); KieBase kieBase = kc.newKieBase(kBaseName, conf); ksession=kieBase.newKieSession(); No more errors are seen in the log. Kiebase is thread safe. Regards, Raj On 14 March 2014 23:38, Raja Sekhar raja.amir...@gmail.com mailto:raja.amir...@gmail.com wrote: Hi Thanks a lot Wolfgang Actually i have 2 bolts 1 bolt gets inserts the facts emitted by sprout and other bolt inserts data into the database. yes 1 bot per fact regarding losing session i mean that does the KieSession(6.0) works in a current technology stack which i am using currently using strom - drools- saving back to database. Regards, Raj On 14 March 2014 19:59, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: +1 Wolfgang :) Raj, we'd need to know things like: how many bolts, how many knowledge bases (I guess one), how many kiesession - a singleton, one per bolt, one per batch of facts...? Also, losing the session since it's running in a multi-threaded environment - what does it mean exactly? Thanks On 03/14/2014 12:42 PM, Wolfgang Laun wrote: The clarity and precision of your descriptions is unsurpassed. -W On 14/03/2014, Raja Sekhar raja.amir...@gmail.com mailto:raja.amir...@gmail.com wrote: We are using storm in big data stack, we are reading data from database and apply rules on them. This is how storm works we have a topology and a spout(input) and bolts(processing and output). spouts will be reading from DB and sending them to the bolt. The bolt will initiate a kiesession and fire the rules after a threshold is reached. the threshold will be decided by spout Here what is happening , suppose we are processing a set of 500 records, 250 are getting processed and 250 are getting failed Please suggest On 14 March 2014 15:53, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Major bugs are usually backported.. are you sure that this fix addresses your problem? In general, if you don't provide a detailed description of your environment and your problem, it will be extremely difficult to help you On 03/14/2014 10:03 AM, Raja Sekhar wrote: Hi Davide, I see that i am loosing the session since i am running is multi-threaded environment I see the following URL https://github.com/droolsjbpm/drools/pull/256/files Are these changed to main branch for version 6.0.1 Regards, Raj On 13 March 2014 23:46, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Do you call session.dispose() after you fire your rules? That exception means that your stateful session was disposed, and you can no longer call methods to insert facts or fire rules (or anything if that matters) on a session that has been disposed. If so, you'll need to create a new one. Davide On 03/13/2014 07:06 PM, Raja Sekhar wrote: Iam using Stateful sessions . On Mar 13, 2014 11:27 PM, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Are you using stateful or stateless sessions? Davide On 03/13/2014 05:01 PM, Raja Sekhar wrote: Hi Can someone help me with this. Regards Raj On 13 March 2014 14:05, Raja Sekhar raja.amir...@gmail.com mailto:raja.amir...@gmail.com wrote: Hi Iam processing dataset stream with storm. After receiving the first set of records the rule is firing. For next set of records i getinet this exception Illegal method call. This session was previously disposed I after firing the rules the session is get disposed. I am not getting where to reeslish the session. Also how i do i know if the session is alive
Re: [rules-users] IllegalStateException:
Major bugs are usually backported.. are you sure that this fix addresses your problem? In general, if you don't provide a detailed description of your environment and your problem, it will be extremely difficult to help you On 03/14/2014 10:03 AM, Raja Sekhar wrote: Hi Davide, I see that i am loosing the session since i am running is multi-threaded environment I see the following URL https://github.com/droolsjbpm/drools/pull/256/files Are these changed to main branch for version 6.0.1 Regards, Raj On 13 March 2014 23:46, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Do you call session.dispose() after you fire your rules? That exception means that your stateful session was disposed, and you can no longer call methods to insert facts or fire rules (or anything if that matters) on a session that has been disposed. If so, you'll need to create a new one. Davide On 03/13/2014 07:06 PM, Raja Sekhar wrote: Iam using Stateful sessions . On Mar 13, 2014 11:27 PM, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Are you using stateful or stateless sessions? Davide On 03/13/2014 05:01 PM, Raja Sekhar wrote: Hi Can someone help me with this. Regards Raj On 13 March 2014 14:05, Raja Sekhar raja.amir...@gmail.com mailto:raja.amir...@gmail.com wrote: Hi Iam processing dataset stream with storm. After receiving the first set of records the rule is firing. For next set of records i getinet this exception Illegal method call. This session was previously disposed I after firing the rules the session is get disposed. I am not getting where to reeslish the session. Also how i do i know if the session is alive or not? -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] IllegalStateException:
+1 Wolfgang :) Raj, we'd need to know things like: how many bolts, how many knowledge bases (I guess one), how many kiesession - a singleton, one per bolt, one per batch of facts...? Also, losing the session since it's running in a multi-threaded environment - what does it mean exactly? Thanks On 03/14/2014 12:42 PM, Wolfgang Laun wrote: The clarity and precision of your descriptions is unsurpassed. -W On 14/03/2014, Raja Sekhar raja.amir...@gmail.com wrote: We are using storm in big data stack, we are reading data from database and apply rules on them. This is how storm works we have a topology and a spout(input) and bolts(processing and output). spouts will be reading from DB and sending them to the bolt. The bolt will initiate a kiesession and fire the rules after a threshold is reached. the threshold will be decided by spout Here what is happening , suppose we are processing a set of 500 records, 250 are getting processed and 250 are getting failed Please suggest On 14 March 2014 15:53, Davide Sottara dso...@gmail.com wrote: Major bugs are usually backported.. are you sure that this fix addresses your problem? In general, if you don't provide a detailed description of your environment and your problem, it will be extremely difficult to help you On 03/14/2014 10:03 AM, Raja Sekhar wrote: Hi Davide, I see that i am loosing the session since i am running is multi-threaded environment I see the following URL https://github.com/droolsjbpm/drools/pull/256/files Are these changed to main branch for version 6.0.1 Regards, Raj On 13 March 2014 23:46, Davide Sottara dso...@gmail.com wrote: Do you call session.dispose() after you fire your rules? That exception means that your stateful session was disposed, and you can no longer call methods to insert facts or fire rules (or anything if that matters) on a session that has been disposed. If so, you'll need to create a new one. Davide On 03/13/2014 07:06 PM, Raja Sekhar wrote: Iam using Stateful sessions . On Mar 13, 2014 11:27 PM, Davide Sottara dso...@gmail.com wrote: Are you using stateful or stateless sessions? Davide On 03/13/2014 05:01 PM, Raja Sekhar wrote: Hi Can someone help me with this. Regards Raj On 13 March 2014 14:05, Raja Sekhar raja.amir...@gmail.com wrote: Hi Iam processing dataset stream with storm. After receiving the first set of records the rule is firing. For next set of records i getinet this exception Illegal method call. This session was previously disposed I after firing the rules the session is get disposed. I am not getting where to reeslish the session. Also how i do i know if the session is alive or not? -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] IllegalStateException:
Are you using stateful or stateless sessions? Davide On 03/13/2014 05:01 PM, Raja Sekhar wrote: Hi Can someone help me with this. Regards Raj On 13 March 2014 14:05, Raja Sekhar raja.amir...@gmail.com mailto:raja.amir...@gmail.com wrote: Hi Iam processing dataset stream with storm. After receiving the first set of records the rule is firing. For next set of records i getinet this exception Illegal method call. This session was previously disposed I after firing the rules the session is get disposed. I am not getting where to reeslish the session. Also how i do i know if the session is alive or not? -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Question to Knowledge-Agent Behaviour
The ResourceChangeScanner will consider a resource modified if last modification last read. If your resource is a URL resource pointing to a file, the implementation (version 5.6, at least) will delegate to File.lastModified(). Make sure that whenever you (re)deploy your PKGs, the lastModified() timestamp is updated On 03/13/2014 12:47 PM, Peach Wyss wrote: Hy all We're having the following situation in our application: ChangeSet: change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' add resource source='file:rules/rules.pkg' type='PKG' / /add /change-set Code: ... // Build initial KnowledgeBase KnowledgeBuilderConfiguration kbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, classloaders); knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConfig); knowledgeBuilder.add(resource, resourceType); //Resource: URL-Resource (Patch to ChangeSet), ResourceType: ChangeSet CollectionKnowledgePackage knowledgePackages = knowledgeBuilder.getKnowledgePackages(); knowledgeBase.addKnowledgePackages(knowledgePackages); // Create and configure Knowledge Agent KnowledgeAgentConfiguration knowledgeAgentConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); knowledgeAgentConfig.setProperty(drools.agent.useKBaseClassLoaderForCompiling, true); knowledgeAgentConfig.setProperty(drools.agent.newInstance, false); knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(MyAgent, knowledgeBase, knowledgeAgentConfig); knowledgeAgent.addEventListener(new KnowledgeAgentEventListener() {...} // Just for debugging purposes knowledgeAgent.monitorResourceChangeEvents(true); knowledgeAgent.applyChangeSet(resource); // Configure Notification and Scanner ResourceChangeScannerConfiguration resourceChangeScannerConfig = ResourceFactory .getResourceChangeScannerService().newResourceChangeScannerConfiguration(); resourceChangeScannerConfig.setProperty(drools.resource.scanner.interval, 10); ResourceFactory.getResourceChangeScannerService().configure(resourceChangeScannerConfig); ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start(); // Get KnowledgeBase from Agent knowledgeBase = knowledgeAgent.getKnowledgeBase(); ... When i replace the rules.pkg with a new package (exported from guvnor with a newer Date Modified), the Knowledge-Base is newly generated. When I replace the pkg with the Package from the previous Version (older Date modified), nothing happens (despite the pkg has changed). Question: Does the agent only updates the Knowledge-Base, when the replaced pkg-File has a newer Date Modified? In our scenario, the expected behaviour would be that the Agent updates the Knowledge-Base everytime the pkg-file changes, so that we can switch between newer and older versions of the pkg-file. Any idea how to achieve this? Thanks for your help. Kind regards, Peter ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] looping in drools
The accumulates should not be in the then part of a rule (see my previous email). That rule gave you two lists, in the variables $plus and $mins, that you can use in the consequence. If you need to process each file separately, you may want to do something like this: rule new file when FileData($old : fileOld, $new : fileNew, fileOld != fileNew) $newFile : String( this not memberOf $old ) from $new then // create new event for a new file : new Event(...) // add to list : Event.listOfEvents.add(...) end You'll need another rule for the files that have been removed. Notice that your Event class has no way to distinguish added from removed files, you may want to add a boolean or something there. Best Davide On 03/10/2014 07:04 PM, Sandhya Sree wrote: hi, im new to drools..im trying to create a project as follows. i have a class called Monitor which monitors a folder and creates two lists called fileOld( which is the list of filenames in that folder at time t1) and fileNew(which is the list of filenames in that folder at time t2). i have another class called FileData which contains two members fileOld and fileNew (list of strings) with getters,setters and constructor. fileOld and fileNew from Monitor Class are passed to FileData class. i also have another class called Event which is as follows: public class Event { public static String name; private File source; private Date timeStamp; public static ListEvent listOfEvents = new ArrayListEvent(); public Event(String name, File source, Date timeStamp) { this.name http://this.name = name; this.source = source; this.timeStamp = timeStamp; } public String getName() { return name; } public void setName(String name) { this.name http://this.name = name; } public File getSource() { return source; } public void setSource(File source) { this.source = source; } public Date getTimeStamp() { return timeStamp; } public void setTimeStamp(Date timeStamp) { this.timeStamp = timeStamp; } now i have to compare these two lists(fileOld and fileNew) in a rule file and if they are not equal i have to create an event object for every file added and deleted and put it in the ListEvent listOfEvents. here is my rule file: rrule files are equal when FileData( fileOld == fileNew) then System.out.println(files are equal); end rule files not equal when FileData($old : fileOld, $new : fileNew, fileOld != fileNew) then accumulate( $s : String( this not memberOf $old ) from $new, $plus : collectList( $s ) ) accumulate( $t : String( this not memberOf $new ) from $old, $mins : collectList( $t ) ) System.out.println(files added: + $plus ); System.out.println( files deleted: + $mins ); end how can i loop through each of the file added or deleted and create an Event Class object for every file added and deleted and finally add all the created objects to ListEvent listOfEvents.. Thanks. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] looping in drools
from will iterate for you, exactly like accumulate counted the events. If you need more details, please consult the documentation On 03/10/2014 07:29 PM, Sandhya Sree wrote: The problem here is even if multiple files are added, there is only one event object created. i want to have like say if 3 new files are added, 3 event objects must be created, and all three event objects must be added to ListEvent listOfEvents. Thanks. On Mon, Mar 10, 2014 at 11:48 PM, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: The accumulates should not be in the then part of a rule (see my previous email). That rule gave you two lists, in the variables $plus and $mins, that you can use in the consequence. If you need to process each file separately, you may want to do something like this: rule new file when FileData($old : fileOld, $new : fileNew, fileOld != fileNew) $newFile : String( this not memberOf $old ) from $new then // create new event for a new file : new Event(...) // add to list : Event.listOfEvents.add(...) end You'll need another rule for the files that have been removed. Notice that your Event class has no way to distinguish added from removed files, you may want to add a boolean or something there. Best Davide On 03/10/2014 07:04 PM, Sandhya Sree wrote: hi, im new to drools..im trying to create a project as follows. i have a class called Monitor which monitors a folder and creates two lists called fileOld( which is the list of filenames in that folder at time t1) and fileNew(which is the list of filenames in that folder at time t2). i have another class called FileData which contains two members fileOld and fileNew (list of strings) with getters,setters and constructor. fileOld and fileNew from Monitor Class are passed to FileData class. i also have another class called Event which is as follows: public class Event { public static String name; private File source; private Date timeStamp; public static ListEvent listOfEvents = new ArrayListEvent(); public Event(String name, File source, Date timeStamp) { this.name http://this.name = name; this.source = source; this.timeStamp = timeStamp; } public String getName() { return name; } public void setName(String name) { this.name http://this.name = name; } public File getSource() { return source; } public void setSource(File source) { this.source = source; } public Date getTimeStamp() { return timeStamp; } public void setTimeStamp(Date timeStamp) { this.timeStamp = timeStamp; } now i have to compare these two lists(fileOld and fileNew) in a rule file and if they are not equal i have to create an event object for every file added and deleted and put it in the ListEvent listOfEvents. here is my rule file: rrule files are equal when FileData( fileOld == fileNew) then System.out.println(files are equal); end rule files not equal when FileData($old : fileOld, $new : fileNew, fileOld != fileNew) then accumulate( $s : String( this not memberOf $old ) from $new, $plus : collectList( $s ) ) accumulate( $t : String( this not memberOf $new ) from $old, $mins : collectList( $t ) ) System.out.println(files added: + $plus ); System.out.println( files deleted: + $mins ); end how can i loop through each of the file added or deleted and create an Event Class object for every file added and deleted and finally add all the created objects to ListEvent listOfEvents.. Thanks. ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 6.0.1.F EXTENDS in Guided Rule Editor does not work
If I remember correclty, extension only works within the same package On 03/06/2014 05:08 PM, SrjTx wrote: BaseRule DRL is package com.xyz.cep; import com.xyz.model.Flow; declare Flow @role(event) end rule BaseRule dialect java when then end - Child.rdslr freshly created and empty other than selecting to extend from BaseRule 1.| package com.securelogix.policy.cep; 2.| 3.| import java.lang.Number; 4.| 5.| rule Child extends BaseRule 6.| dialect mvel 7.| when 8.| then 9.| end -- View this message in context: http://drools.46999.n3.nabble.com/6-0-1-F-EXTENDS-in-Guided-Rule-Editor-does-not-work-tp4028506p4028571.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Facing Problem with this exception
Similar bugs have been fixed over different versions, but it's very difficult to tell without some context. One would need at least the rule that causes the exception, but a minimal reproducer (rules + facts) would be ideal. On 03/05/2014 11:12 AM, Wolfgang Laun wrote: Could be a bug that has been fixed in some later version - can someone confirm this please? OP is using drools 5.1.1, and should try 5.6. -W On 05/03/2014, Mallikarjun Kohalli (mkohalli) mkoha...@cisco.com wrote: Hi All, We are getting the following exceptions when drools is executing some rules. Exception: Caused by: java.lang.NullPointerException at org.drools.core.util.LeftTupleIndexHashTable.remove(LeftTupleIndexHashTable.java:251) at org.drools.reteoo.NotNode.retractLeftTuple(NotNode.java:226) at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractRightTuple(SingleLeftTupleSinkAdapter.java:124) at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:151) at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:232) at org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:412) at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1471) ... 51 more Regards, Mallikarjun K ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBoundsException under high events load in drools CEP
Thanks, we'll look into this as soon as possible!! Davide On 03/04/2014 06:46 PM, ters wrote: Davide Sottara wrote However, the *deadlock* situation might have exposed a bug. Could you please submit a self-contained reproducer? Davide, I've posted on forum new topic with complete example and description http://drools.46999.n3.nabble.com/Drools-6-0-1-CEP-stucks-during-marshaling-in-fireUntilHalt-mode-td4028493.html Hope it helps anyone of us. -- View this message in context: http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028494.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Guvnor - Custom operator problem (Not finding it)
Evaluators are typically registered in the packagebuilder.conf file, or passed to the packagebuilder. Did you do something equivalent in guvnor? On 03/04/2014 05:46 PM, mattmadhavan wrote: Hello, I have written a custom operator called inlist and it works great in 5.4.0 (not in 5.6.0). When I import the rules to Guvnor my rule validation fails with the following error: /[Administration and Timing of RT - Date RT started unknown, assumed started more than 365 days of diagnosis] Unable to determine the Evaluator for ID '*inlist*'/ Any ideas please? Thanks Matt -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Custom-operator-problem-Not-finding-it-tp4028490.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Simple aggregation problem
Raja, it is not clear what you are trying to achieve. The rule might be well written or not, we don't know your requirements. If id is what it should be - an identifier - your accumulate constraint would match a single object for each Product (the original product itself), which looks suspicious. I'll assume that you are doing a performance test and you are not satisfied with the overall execution time. The question, however, is: how many facts are you inserting? Are you firing all rules after the insertion of each fact, or just once at the end? Last, but not least, which version are you using? Accumulate should be used carefully in combination with insertLogical, since the former updates its result every time its fact collection changes. The latter will generate a new fact, keep track of its dependencies, and replace it when the accumulation result itself changes. Of course, if you were inserting 100 facts, the numbers would raise a warning, but could be reasonable for several thousands, if not hundred thousands. Citing one of your previous emails: I want to test my rules with 10,000 facts to 20,000,000 facts Best Davide On 03/03/2014 12:10 PM, Raja Sekhar wrote: Hi, I am using the following rule package com.demo; import com.sample.model.Product; import com.sample.model.Products; import java.util.List; import java.util.Set; dialect mvel rule Product_0 no-loop when Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) ) then insertLogical(hid= + id +,T1= + $sum1); end I am inserting facts (Product objects) into it and firing the rules. When i took performance stats from visual vm with JMX. got a time of 3832ms. I can you suggest if i am doing any thing wrong with this. Regards, Raja Sekhar -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Simple aggregation problem
Drools does not have groupBy, the rule you have written will react to each Product. You need something like: rule Acc when // get all Ids accumulate( Product( $id : id ), $ids : collectSet( $id ) ) // for each Id $idx : String() from $ids // accumulate the Products accumulate( Product( id == $idx, $p : price ), $sum : sum( $p ) ) then System.out.println( $idx + ' : ' + $sum ); end This is to give you an idea, for example you could split the rule in two or use helper facts On 03/03/2014 12:43 PM, Raja Sekhar wrote: Hi Davide, I am trying to group by Hild. Here first i will get the hlld into id and segregate the results by hild and sum the value t1 If you take an sql select sum(t1),hlid from product group by hild so i will get if the data is hlid t1 110 110 2 10 2 10 the result would be hiid t1 1 20 2 20 Hope you understand what i am trying to do here Regards, Raja Regards, Raja On 3 March 2014 17:05, Davide Sottara dso...@gmail.com mailto:dso...@gmail.com wrote: Raja, it is not clear what you are trying to achieve. The rule might be well written or not, we don't know your requirements. If id is what it should be - an identifier - your accumulate constraint would match a single object for each Product (the original product itself), which looks suspicious. I'll assume that you are doing a performance test and you are not satisfied with the overall execution time. The question, however, is: how many facts are you inserting? Are you firing all rules after the insertion of each fact, or just once at the end? Last, but not least, which version are you using? Accumulate should be used carefully in combination with insertLogical, since the former updates its result every time its fact collection changes. The latter will generate a new fact, keep track of its dependencies, and replace it when the accumulation result itself changes. Of course, if you were inserting 100 facts, the numbers would raise a warning, but could be reasonable for several thousands, if not hundred thousands. Citing one of your previous emails: I want to test my rules with 10,000 facts to 20,000,000 facts Best Davide On 03/03/2014 12:10 PM, Raja Sekhar wrote: Hi, I am using the following rule package com.demo; import com.sample.model.Product; import com.sample.model.Products; import java.util.List; import java.util.Set; dialect mvel rule Product_0 no-loop when Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) ) then insertLogical(hid= + id +,T1= + $sum1); end I am inserting facts (Product objects) into it and firing the rules. When i took performance stats from visual vm with JMX. got a time of 3832ms. I can you suggest if i am doing any thing wrong with this. Regards, Raja Sekhar -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] problem with drools
There are a few errors in the rules 1) not FileData( fileOld == fileNew ) will fire either 1) when there is a FileData with different lists OR 2) when there is no FileData at all in the workingMemory 2) the rule should not compile, unless fileOld and fileNew are STATIC fields of the class FileData. Is this the case? If so, why? The problem is that the rule will fire also when there is no FileData in the WM, so calling the function there is pointless Your rule should be rewritten as : (notice that the != operator is overloaded, so it correctly computes not equals) FileData( fileOld != fileNew ) 3) To do what you want, you don't even need the function - if you prefer to use functions and code, consider dropping Drools. A possible rule-based approach to your problem is this: rule Deltas when FileData( $old : fileOld, $new : fileNew, fileOld != fileNew ) accumulate( $s : String( this not memberOf $old ) from $new, $plus : collectList( $s ) ) accumulate( $t : String( this not memberOf $new ) from $old, $mins : collectList( $t ) ) then System.out.println( $plus ); System.out.println( $mins ); end The other rule is fine. Best Davide On 02/28/2014 09:54 AM, Sandhya Sree wrote: hi, im new to drools..im trying to create a project as follows. i have a class called Monitor which monitors a folder and creates two lists called fileOld( which is the list of filenames in that folder at time t1) and fileNew(which is the list of filenames in that folder at time t2). i have another class called FileData which contains two members fileOld and fileNew (list of strings) with getters,setters and constructor. fileOld and fileNew from Monitor Class are passed to FileData class. now i have to compare these two lists in a rule file and if they are not equal i have to print the lists of files added/ deleted. how to do this in drools. here is my rule file: rule files are equal when FileData(fileOld == fileNew) then System.out.println(files are equal); end rule files not equal when not FileData(fileOld == fileNew) then System.out.println(files are not equal); difference(FileData.getFileOld(),FileData.getFileNew()); end function void difference(List fileOld, List fileNew) { ArrayListString add = new ArrayListString(fileNew); add.removeAll(fileOld); System.out.println(files Added: + add); ArrayListString remove = new ArrayListString(fileOld); remove.removeAll(fileNew); System.out.println(files Removed: + remove); } but this displays the following error... Rule Compilation error : [Rule name='files not equal'] Cannot make a static reference to the non-static method getFileOld() from the type FileData Cannot make a static reference to the non-static method getFileNew() from the type FileData what can be done?? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] NullPointerException when calling Scan manually
Could you please share the unit test? Thanks Davide On 02/27/2014 11:42 AM, Brecht De Rooms wrote: Dear Drools users, I just merged all my code to Drools 6.0.1 and I am happy to see that it is more stable. Several issues I had with 5.6.x do not present themselves in 6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a unit test in which I deploy new rules and then call scanNow. Often the unit test succeeds, but sometimes it throws this nullpointer exception. java.lang.NullPointerException at org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668) at org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658) at org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653) at org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150) at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149) at org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214) at org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204) at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111) at derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104) at derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84) at derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50) at derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105) at java.lang.Thread.run(Thread.java:744) Does anyone have an idea what the problem might be? Kind Regards, Brecht - Brecht De Rooms Phd Student @ WISE Department of Computer Science Vrije Universiteit Brussel Pleinlaan 2, B-1050 Brussels, Belgium office: 10 G 731f phone: +32 2 629 37 49 email: bdero...@vub.ac.be - --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x
We could reproduce the issue, it's now in a unit test: https://github.com/droolsjbpm/drools/pull/317/files Thanks for reporting this!! Davide On 02/28/2014 12:44 AM, mikerod wrote: I made a basic jar that only depends on Drools. All the rules do is output to standard out to demonstrate. This can just be ran with: `mvn exec:java -Dexec.mainClass=example.drools.TestingNestedNegation` This is with v6.0.1.Final; so switching this in the pom.xml to 5.6.0.Final, for example, will cause the different behavior between the versions i.e. changing drools.version6.0.1.Final/drools.version in pom.xml . @Mark I looked at the link and he had a zip file. I'm guessing a jar with a main class in it is sufficient? drools-example-tests-1.0-SNAPSHOT.jar http://drools.46999.n3.nabble.com/file/n4028398/drools-example-tests-1.0-SNAPSHOT.jar Also, I am still using the now, legacy API for the kb and Stateful session. I tried to add the logback.xml config file, but it doesn't seem to work quite so simply there. That is likely due to me not reading up on the new API yet... I'm hoping the initial uplift to v6.x can just be to the legacy API and migrate over later on. I don't think the API choice would make this behavioral change in the rules nonetheless. Let me know what else would be helpful. -- View this message in context: http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390p4028398.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop
I think I see the problem - though I haven't been able to test it with guvnor. Property Reactivity is resolved at compile time, when the package is built. When you load the DRL, you set PropertyReactive.ALWAYS in the (local) KnowledgeBuilder, so it will consider all classes as PR. However, afaik there is no way to do the same in Guvnor, so its (remote) builder will create the Packages as if the classes were NOT PropertyReactive. Could you try to annotate the model classes with @PropertyReactive before you load the jar in guvnor? Davide On 02/25/2014 11:53 PM, gboro54 wrote: test-drools.zip http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip Here is a sample project which shows the issue. You can build the project as the fact model and upload the drl into guvnor -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop
Ok, so I have to test it. There could be two possible failure points: 1) The compiler should see the annotations and create the internal data structures, tracking the fact that the classes are @PR 2) The data structures are declared in the package of the beans, which is not (necessarily) the package where the rules are defined. We have to ensure that ALL packages are downloaded from guvnor. To check #2, it should be enough to ensure that the rules and the classes live in the same package I'll get back to you later Davide On 02/26/2014 03:59 PM, gboro54 wrote: No luck adding ProperReactive to the classes(in the sample project). Davide Sottara wrote I think I see the problem - though I haven't been able to test it with guvnor. Property Reactivity is resolved at compile time, when the package is built. When you load the DRL, you set PropertyReactive.ALWAYS in the (local) KnowledgeBuilder, so it will consider all classes as PR. However, afaik there is no way to do the same in Guvnor, so its (remote) builder will create the Packages as if the classes were NOT PropertyReactive. Could you try to annotate the model classes with @PropertyReactive before you load the jar in guvnor? Davide On 02/25/2014 11:53 PM, gboro54 wrote: test-drools.zip lt;http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zipgt; Here is a sample project which shows the issue. You can build the project as the fact model and upload the drl into guvnor -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028335.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] What is the 5.6_dynamic branch?
5.6.x is the master of the 5.x series.. 5_6 dynamic is a temporary branch, created for development or test purposes, which has never been deleted On 02/26/2014 09:59 PM, dunnlow wrote: What is the difference between the 5.6.x and 5.6_dynamic branches in github? Thanks, -J -- View this message in context: http://drools.46999.n3.nabble.com/What-is-the-5-6-dynamic-branch-tp4028353.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Source from Snapshot in Guvnor 5.6
Yes, instead of the URL http:// ... /packages/ [my pack ] / binary use http:// ... /packages/ [my pack ] / source On 02/26/2014 10:24 PM, gboro54 wrote: Is there a way to download the drl of a snapshot? I know you can see the rules in the Guvnor(uneditable of course) but is there a way to actual download the DRL file? -- View this message in context: http://drools.46999.n3.nabble.com/Source-from-Snapshot-in-Guvnor-5-6-tp4028355.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools error log msg?
You likely have configured a DebugAgendaEventListener, which logs agenda events (rules activated, fired, etc..) on the standard error rather than the standard output. If you want a different behavior, remove the listener and implement one of your own. These are not errors anyway. Davide On 02/25/2014 09:40 AM, Markus Schneider wrote: Hi list, I see the following error msg in my drools log but I don't know how to interpret this. Do I have a serious problem here? Has anybody a clue? Thanks in advance. Cheers, -markus | Error ==[AfterActivationFiredEvent: getActivation()=[Activation rule=UpdateAlertRule, act#=37, salience=900, tuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87] | Error ==[BeforeActivationFiredEvent: getActivation()=[Activation rule=EventRetractionRule, act#=36, salience=1, tuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87] EventRetractionRule is processed. | Error ==[ObjectRetractedEventImpl: getFactHandle()=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19], getOldObject()=rapideca.plugins.rbm.entity.Event : 19, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=2, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19], leftTuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] , originOffset=-1, propagationNumber=40, rule=[Rule name=EventRetractionRule, agendaGroup=MAIN, salience=1, no-loop=true], type=1]] 2014-02-25 08:59:03,524 [eventQueueReceiverJmsListenerContainer-1] INFO log.RuleLogHandler - RuleLog with id: 38 was successfully saved. | Error ==[AfterActivationFiredEvent: getActivation()=[Activation rule=EventRetractionRule, act#=36, salience=1, tuple=[fact 0:-1:184363445:184363445:19:null:null] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87] ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools error log msg?
'], _category:catalog['category'], _severity:catalog['severity'], _priority:catalog['priority'], _state:catalog['state'], _source:catalog['source'], _subSource:catalog['subSource'], _origin:catalog['origin'], _subOrigin:catalog['subOrigin'], _owner:catalog['owner'], _description:catalog['description'], _selector:(from Alert where + name=' + catalog['name'] + ' + and severity=' + catalog['severity'] + ' + and not state='Closed' ) ) eval(isDuplicate(_event,CreateAlertRule,_selector) == false) then System.out.println(CreateAlertRule is processed.); EntityBuilder entityBuilder = new EntityBuilder(); entityBuilder.addProperty(modifiedBy,CreateAlertRule); entityBuilder.addProperty(name,_name); entityBuilder.addProperty(category,_category); entityBuilder.addProperty(severity,_severity); entityBuilder.addProperty(priority,_priority); entityBuilder.addProperty(state,_state); entityBuilder.addProperty(source,_source); entityBuilder.addProperty(subSource,_subSource); entityBuilder.addProperty(origin,_origin); entityBuilder.addProperty(subOrigin,_subOrigin); entityBuilder.addProperty(owner,_owner); entityBuilder.addProperty(description,_description); AlertHandler alertHandler = new AlertHandler(entityBuilder.getProperties(),_selector); alertHandler.create(); RuleLogHandler ruleLogHandler = new RuleLogHandler(); ruleLogHandler.create(CreateAlertRule,_name); end //-- rule 'EventRetractionRule' //-- dialect 'mvel' salience 1 no-loop when _event : Event(eventClass == Event, _name:catalog['name'] not contains 'Timer' ) then System.out.println(EventRetractionRule is processed.); retract(_event); RuleLogHandler ruleLogHandler = new RuleLogHandler(); ruleLogHandler.create(EventRetractionRule,_name); end 2014-02-25 14:00 GMT+01:00 Markus Schneider markus.schneide...@gmail.com mailto:markus.schneide...@gmail.com: Hi Davide, thank you for the fast response. I've defined an DebugAgendaEventListener as it's described here: Drools Docu 5.5.0-Final/Section 7.2/HelloWorld example. http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/index.html Where can I find any docu about the config of the DebugAgendaEventListener? Cheers, -markus 2014-02-25 12:59 GMT+01:00 Davide Sottara dso...@gmail.com mailto:dso...@gmail.com: You likely have configured a DebugAgendaEventListener, which logs agenda events (rules activated, fired, etc..) on the standard error rather than the standard output. If you want a different behavior, remove the listener and implement one of your own. These are not errors anyway. Davide On 02/25/2014 09:40 AM, Markus Schneider wrote: Hi list, I see the following error msg in my drools log but I don't know how to interpret this. Do I have a serious problem here? Has anybody a clue? Thanks in advance. Cheers, -markus | Error ==[AfterActivationFiredEvent: getActivation()=[Activation rule=UpdateAlertRule, act#=37, salience=900, tuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87] | Error ==[BeforeActivationFiredEvent: getActivation()=[Activation rule=EventRetractionRule, act#=36, salience=1, tuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87] EventRetractionRule is processed. | Error ==[ObjectRetractedEventImpl: getFactHandle()=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19], getOldObject()=rapideca.plugins.rbm.entity.Event : 19, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=2, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19], leftTuple=[fact 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event : 19] , originOffset=-1, propagationNumber=40, rule
Re: [rules-users] ArrayIndexOutOfBoundsException under high events load in drools CEP
Persisting sessions manually, especially out of synchronization and transactions, is not recommended. As previously suggested by Mario, could you try the JPA Persistent Sessions? However, the *deadlock* situation might have exposed a bug. Could you please submit a self-contained reproducer? Thanks Davide On 02/25/2014 02:13 PM, Ievgenii wrote: Hello, I have the same problems in my CEP project, and I would appreciate any help. It's very important for me. Thank you. Best Regards, Ievgeni. -- View this message in context: http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028301.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop
Interesting.. this may be a bug in the serialization process, and it may affect 6.x too Could you please check it with a package that contains a single rule using a single @propertyReactive class? On 02/25/2014 09:25 PM, gboro54 wrote: Also note we are using property reactive listener always. The rules do modify an object that a bunch of the rules use however the modified property is not being evaluated(i.e no rule is checking the property at the moment). -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028320.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop
Thanks! I'll get back to you tomorrow with the results On 02/25/2014 11:53 PM, gboro54 wrote: test-drools.zip http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip Here is a sample project which shows the issue. You can build the project as the fact model and upload the drl into guvnor -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] in syntax breaking the Rete Tree
Please open a JIRA ticket, this is the way bugs are reported to the development team. https://issues.jboss.org/browse/DROOLS Davide On 02/20/2014 03:38 PM, droolster wrote: @laune, any update? Should I post to Stackoverflow as you are active there. Is this forum dead? -- View this message in context: http://drools.46999.n3.nabble.com/in-operator-breaking-the-Rete-Tree-tp4028148p4028204.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] packageBuilder.getPackage() returns null
Could you provide a full reproducer: rules, java snippet and stack trace of your exceptions? As a side note, is the path correct? dymanic looks like a typo.. Thanks Davide On 02/17/2014 09:34 AM, Raja Sekhar wrote: Hi i am trying to use drools template String drl = resultSetGenerator.compile(resultSet, new FileInputStream(new File(D:\\Raj\\dymanic.drt))); complied drl as above when i try add the pakage packageBuilder.getPackage() it return null i am using the 5.6.0.Final version of drools Regards, Raja Sekhar Amirapu -- If any anyone can do it, i can do it. If no one else can do it, i must do it ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.NullPointerException when using a custom operator
Unfortunately I am not completely surprised... ironically, that function signature was changed at some point to simplify the code and make it more robust internally. The change, however, broke the backwards compatibility with existing custom implementations (something the users can fix) and the way the evaluators are invoked by MVEL in the constraints. The latter required to create an EvaluatorWrapper class which is responsible for matching the Objects to their handles and extractors. From what you say, there seems to be a problem in the latter: the first step return back the same factHandle object Could you make sure that the factHandle is holding the correct object and that the extractor is a ClassFieldExtractor trying to read the appropriate field? A self-contained reproducer would also be appreciated. Some bugs related to the custom evaluators were fixed last week in 6.1 master, it would be important to know if this bug is still there, and whether the fixes should be backported and how Thank you in advance Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-java-lang-NullPointerException-when-using-a-custom-operator-tp4025287p4028143.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Custom Operator - 5.4.0 works but nor not in 5.6.0.
Matt, I had answered another thread directly on the forum, I'm not sure that it made it to the user list. This was my answer: Unfortunately I am not completely surprised... ironically, that function signature was changed at some point to simplify the code and make it more robust internally. The change, however, broke the backwards compatibility with existing custom implementations (something the users can fix) and the way the evaluators are invoked by MVEL in the constraints. The latter required to create an EvaluatorWrapper class which is responsible for matching the Objects to their handles and extractors. From what you say, there seems to be a problem in the latter: the first step return back the same factHandle object Could you make sure that the factHandle is holding the correct object and that the extractor is a ClassFieldExtractor trying to read the appropriate field? A self-contained reproducer would also be appreciated. Some bugs related to the custom evaluators were fixed last week in 6.1 master, it would be important to know if this bug is still there, and whether the fixes should be backported and how Thank you in advance Davide I have noticed another small detail: The error is: [Error: inlist0.evaluate( PRIMARY_SITE, (C500-C505) ): org.drools.common.DefaultFactHandle cannot be cast to java.lang.String] [Near : {... inlist0.evaluate( PRIMARY_SITE }] Since PRIMARY_SITE is capitalized, is it a regular field, or something else like a global? There was a bug we found last week which may be related: https://issues.jboss.org/browse/DROOLS-426 Davide On 02/17/2014 05:25 PM, mattmadhavan wrote: Hi Wolfgang, cannot cast primarySite to a FactHnadle is the out put I am receiving from the rule processing. The reality is that, there is an issue with my custom operator when I try to extract the value. Any ideas please? Thanks Matt -- View this message in context: http://drools.46999.n3.nabble.com/Custom-Operator-5-4-0-works-but-nor-not-in-5-6-0-tp4028126p4028152.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.NullPointerException when using a custom operator
Could you please show the stack trace of the exception and the rule that causes it? Thanks Davide On 02/14/2014 02:38 AM, mattmadhavan wrote: Hello, I am having a hard time with a custom operator. It works great in 5.2 but not in 5.6. Do you mind sharing your email ample for 5.6 please? I spent the whole day today on this issue. There are Any differences between a 5.2 5.6 and 6.0.x. Your example works great for 6.0.x btw. Thanks in advance.! Matt -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-java-lang-NullPointerException-when-using-a-custom-operator-tp4025287p4028110.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBoundsException under high events load in drools CEP
I can see a few independent issues here. Drools 5.x was not designed to be thread-safe in general: there are some known critical races that may arise when multiple threads are inserting facts in parallel. Many have been patched in 5.6, but the real solution to the problem will be introduced in the 6.x series. On a separate notice, are you trying to marshal the session while facts are being inserted by the various threads? I don't think that there is a test case for that, so a reproducer would be really appreciated. Thanks Davide On 02/11/2014 03:20 PM, ters wrote: Hi, drools users/developers. As mentioned in subject, I often faced ArrayIndexOutOfBoundsException under high events load in drools during marshaling. Conditions: drools CEP (5.4.0.Final), Stream mode, fireUntilHalt mode, during very active marshaling process (in several threads) I often have such trace: java.lang.ArrayIndexOutOfBoundsException: 2773 at org.drools.marshalling.impl.ProtobufOutputMarshaller.orderFacts(ProtobufOutputMarshaller.java:592) at org.drools.marshalling.impl.ProtobufOutputMarshaller.writeFactHandles(ProtobufOutputMarshaller.java:533) at org.drools.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:139) at org.drools.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:100) at org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169) at org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151) at com.blablabla.cep.CEPEventProcessor.marshalWorkingMemory(CEPEventProcessor.java:332) This exception occurs really often. I googled fresh tracked bug https://bugzilla.redhat.com/show_bug.cgi?id=1044577. As I understand, this bug is fixed in drool 5.3.x branch, but we using drools-core 5.4.0.Final. So could you please help me what to do with this exeption? Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools : 2 identical calls to the same knowledgeBase don't give the same result… why?
It is a bug, I'd say related to constraint jitting.. It seems to work with 5.6.0.Final, could you please try that version? Thanks Davide On 02/10/2014 06:06 PM, antoine wrote: Hello, I've faced some weird result using Drools 5.5.0.Final, and I would like to know if I am doing something wrong ? I am using drools to process some user rules (the Excel way). If I call the rules with the exact same data at different time in the process, I don't get the same result. (I am using a StateLessSession) After digging a bit more, I managed to extract a very simple maven-based unit-test to reproduce the problem. (the archive can be downloaded here : http://www.filedropper.com/using-drools http://www.filedropper.com/using-drools ) In fact, I call many times to execute the same rule, and after the 23rd times I don't get the same expected result : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ classpath:status-rules-config.xml }) public class StatusRuleTest { @Autowired StatusRule ruleRunner; @Test public void do_not_work_at_25th_call() throws Exception { for(int i = 0 ; i 35 ; i++){ MyFact fact = new MyFact(); assertThat(fact.getStatus()).isEqualTo(NONE); ruleRunner.defineStatus(fact); assertThat(fact.getStatus()).isEqualTo(DONE); } } } with rule definition as : public class StatusRuleImpl implements StatusRule { @Setter private StatelessKnowledgeSession ksessionStatus; @Override public void defineStatus(MyFact myFact) { ksessionStatus.addEventListener(new DebugAgendaEventListener() ); ksessionStatus.addEventListener(new DebugWorkingMemoryEventListener()); ksessionStatus.execute(myFact); } } It uses a statelessSession, with sequential mode and ACTIVATION-GROUP column. I also posted more details and more logs here : http://stackoverflow.com/questions/21585666/drools-2-identical-calls-to-the-same-knowledgebase-dont-give-the-same-result http://stackoverflow.com/questions/21585666/drools-2-identical-calls-to-the-same-knowledgebase-dont-give-the-same-result From what I checked, it might be coming from the negative BigDecimal (If I change it to 10 in both of the code and the Excel, it seems to work) If someone has an Idea, I will be pleased to read it ! Thanks in advance, Antoine -- View this message in context: http://drools.46999.n3.nabble.com/Drools-2-identical-calls-to-the-same-knowledgeBase-don-t-give-the-same-result-why-tp4028038.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.6.0.CR1 gives a NullPointerException in after evaluator
Noted, and under investigation. Thanks Davide On 02/03/2014 12:32 PM, nxv wrote: Hello, I have the same problem with kie 6.1.0-SNAPSHOT :( Here is the unit test: Drools-after-61.zip http://drools.46999.n3.nabble.com/file/n4027965/Drools-after-61.zip nxv wrote The problem is the same as reported by abr. I work with abr on the project :) As he could not reproduce the bug, I just removed lines of code as much as possible to keep only the essentials. Here is a unit test: Drools-after.zip http://drools.46999.n3.nabble.com/file/n4027676/Drools-after.zip Davide Sottara wrote This is unlikely to be the same exception that started the initial thread, but a problem nevertheless.. :( could you create a self-contained test case and submit it? Thanks Davide On 01/13/2014 08:05 AM, Mark Proctor wrote: That was recreated on 5.6.0.CR1 ? The 5.6 ship has sailed now :( and currently there are no plans for 5.7 any time soon. We should focus on making sure this is fixed in 6.x. Mark On 12 Jan 2014, at 19:21, nxv lt; nxvanderlinden@ gt; lt;mailto: nxvanderlinden@ gt; wrote: Hello, I'm able to reproduce this issue with a KB containing only 1 rule. rule Qualification##ToControl salience 50 when $p: AccessRegisterSnapshot( $effDt: effectivedate ) $dpo: DeliveryPoint() $gCfg: GeneralConfig( ( todate == null || ( todate after[ 0d ] $effDt todate after[ 1ms ] fromdate ) ) ) from $dpo.generalConfigs then end This rule worked under drools 5.5.0.Final. Caused by: java.lang.NullPointerException at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluate(AfterEvaluatorDefinition.java:347) at org.drools.base.EvaluatorWrapper.evaluate(EvaluatorWrapper.java:99) Davide Sottara wrote I tried to reproduce the problem, with no success. Could you please create a self-contained unit test? If confirmed, I'll fix the problem as soon as possible Thanks Davide On 11/14/2013 04:48 AM, abr wrote: Hi everyone, I tried to switch from 5.5.0.Final to 5.6.0.CR1 and got a null pointer exception in the evaluation of the after evaluator. (Exact method is: /org.drools.base.evaluators.AfterEvaluatorDefinition.AfterEvaluator.evaluate(InternalWorkingMemory, InternalReadAccessor, InternalFactHandle, InternalReadAccessor, InternalFactHandle)/ ) When debugging, the exception occurs at the very first line of the method, in: /if ( extractor1.isNullValue( workingMemory, handle1.getObject() ) || extractor2.isNullValue( workingMemory, handle2.getObject() ) ) { return false; } / The cause of the exception is that handle1 is null. The rule where the exception occurs looks like: /MyFact( fromdate before[ 0d ] $min, ( todate == null || todate after[ 0d ] $max ) ) / When the exception occurs, /MyFact.fromdate/ is not null, /$min/ is not null, /MyFact.todate/ is null, /$max/ is not null. In AfterEvaluator.evaluate : /extractor1/ refers to /MyFact.todate/, /extractor2/ refers to /$max/, /handle1/ is null, /handle2/ refers to the fact including the attribute to which /$max/ variable is bound to. Of course, this worked fine in 5.5.0.Final. -- View this message in context: http://drools.46999.n3.nabble.com/5-6-0-CR1-gives-a-NullPointerException-in-after-evaluator-tp4026780p4027965.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Incorrect resolution of global symbols in LHS rule constraint (Java dialect)
Thanks, today we have actually identified the real cause of the error and we are already working to get it fixed. I wonder if a cast would also work : MyType( (Boolean) global_invoke( this ) ) Davide On 01/30/2014 10:03 PM, mikerod wrote: Thank you for your reply. That was helpful. I did notice that the workaround you proposed of only calling the `some.classpath.package2.MyType ( global_instance.invoke(this) )` was still not analyzing the constraint correctly. I think this was because #invoke() was returning an java.lang.Object type (which would be a java.lang.Boolean at runtime). This led us to the discovery that if we just flipped the order of the constraint expression to: `some.classpath.package2.MyType ( true == global_instance.invoke(this) )` it works fine. It looks like with beginning the expression with `true ==` instead of having it `== true` after the method call, was able to be analyzed correctly. I posted a Jira for this @ https://issues.jboss.org/browse/DROOLS-420 . I haven't logged a Drools Jira before, so hopefully it is filled out as expected/desired. -- View this message in context: http://drools.46999.n3.nabble.com/Incorrect-resolution-of-global-symbols-in-LHS-rule-constraint-Java-dialect-tp4027921p4027935.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Null Pointer Exception with 10K+ kBase objects
Could you post the full test case (rules + java)? Thanks Davide On 01/28/2014 05:10 PM, jhusby wrote: I'm trying to stress-test Drools to see what its limits are, and I stumbled across a NPE when I have a large amount of facts in a stateful knowledgebase: java.lang.NullPointerException at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuple(PhreakTimerNode.java:355) at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuples(PhreakTimerNode.java:325) at org.drools.core.phreak.PhreakTimerNode.doNode(PhreakTimerNode.java:72) at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:357) at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161) at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116) at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:200) at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:67) at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935) at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200) at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:957) at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:931) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:256) I have a little program that creates, populates, fires, and destroys a session repeatedly. With 10K objects in the knowledge base, I get the NPE the first time I loop through my program, but not subsequently (probably because by the subsequent executions things have been cached). With 100K objects, I get the exception most times. With 1M objects, I get the NPE every time. Am I doing anything wrong or is it simply taking so long to execute all the rules that something times out? Is there a timeout param I could set? Thank you! Joseph -- View this message in context: http://drools.46999.n3.nabble.com/Null-Pointer-Exception-with-10K-kBase-objects-tp4027887.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java dialect and declared types
Declared types have public accessors as usual. This seems a minor bug in the expression analysis. Can you try getRaw().complicated() and / or raw.complicated and report what happens? Thanks Davide On 01/23/2014 06:40 AM, pmander wrote: If I declare a type in a drl and reference the attributes in a rule then all is fine for either dialect. But, if one of the attributes is a java class that has been compiled and inserted then under the java dialect only I get a compilation error: rule compilation error the field ... is not visible for example declare DroolsTransaction ORG : String PRODUCT : String raw : Transaction end rule create classes salience 100 when $t : Transaction() then insert(new DroolsTransaction((String)$t.fieldFor(ORG), (String)$t.fieldFor(PRODUCT), $t)); end I insert Transaction objects in the session and this works fine for the following rule if I have the dialect set to mvel. rule 1 when $t : DroolsTransaction(ORG == A , PRODUCT == 001, raw.complicated()) then do something end but when I switch dialects to java, the compilation complains that raw is not visible. I guess drools is dynamically creating the DroolsTransaction object with private fields... and I need public accessors - how to define them? -- View this message in context: http://drools.46999.n3.nabble.com/java-dialect-and-declared-types-tp4027822.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java dialect and declared types
In that case I'm almost sure that the whole constraint has to be treated as a java expression. So yes, you will probably need getRaw().complicated( ... ) On 01/23/2014 08:06 AM, pmander wrote: will do, although complicated() has parameters and so I think I'll only able to try getRaw.complicated() -- View this message in context: http://drools.46999.n3.nabble.com/java-dialect-and-declared-types-tp4027822p4027825.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java dialect and declared types
Yes, if you use the java dialect, the whole RHS is parsed as a java block with some minor syntactic sugar (e.g. insert). On 01/23/2014 08:46 AM, pmander wrote: Davide Sottara wrote Declared types have public accessors as usual. This seems a minor bug in the expression analysis. Can you try getRaw().complicated() and / or raw.complicated and report what happens? Thanks Davide getRaw().complicated() works. This isn't just in the constraint. I use raw in the then also and it needs changing to getRaw() also. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/java-dialect-and-declared-types-tp4027822p4027827.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Dynamic rules in Drools 6
There may be some misunderstanding here.. you can indeed rebuild the jar, but there is also a programmatic way to add (DRL) resources to an in-memory FS and update the KBs/KSs on the fly. See the examples in IncrementalCompilationTests Davide On 01/23/2014 10:11 AM, Mark Proctor wrote: On 23 Jan 2014, at 16:02, jhusby husby...@umn.edu wrote: Looking at the test case from Edson, quoted below, it appears that there's no way to reuse a current session when upgrading the kbase rules? I need to add and remove rules on the fly, and so if I have a stateful session, does this mean I need to dispose of the current session, upgrade the container, create a new session, and repopulate it with all my objects? I was hoping to simply rebuild the repository, call kContainer.updateToVersion(), and have the the session (with all my objects still populated) automatically use that new version of the rules repository. Is this not possible? yes,this is how it works now. Make sure you build the jar with the maven plugin, so that it can performance the incremental diff. We have a number of low level unit tests, that show this should work. If you have found a bug, please update the test class here: https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java Mark Thanks, Joseph Edson Tirelli-4 wrote Here is a code example of creating kie modules in memory and upgrading existing kbases/ksessions: https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java#L106 It is a test case, but maybe it will be easier to follow. We are working on additional ways of doing similar things as well. Edson -- View this message in context: http://drools.46999.n3.nabble.com/Dynamic-rules-in-Drools-6-tp4027833.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Buggy query behavior in drools 5.6 and 6.1-SNAPSHOT ??
I'd say it's a bug... maybe indexing is involved? Replacing ruleA's LHS with $p: Parent( $a2 : attribute2 != null) ?getChildWithName($a2 , n1, $child;) makes it work as expected. I will investigate further. Davide On 01/22/2014 02:22 PM, Esteban Aliverti wrote: Hi guys, I was writing some rules using backward chaining and found a strange behavior. I managed to isolate the error in the test project I'm attaching. In the project I have 2 classes: Parent and Child Parent: * String id * String attribute1 * String attribute2 * ListChild children Child: * String parentId; * String name; * String value; In the test I'm creating 1 Parent object with just 1 child and then inserting the Parent object into a drools session: Parent p1 = new Parent(); p1.setId(1); p1.setAttribute1(a1); p1.setAttribute2(null); Child c1p1 = new Child(); c1p1.setName(n1); c1p1.setParentId(p1.getId()); c1p1.setValue(v1.1); p1.addChild(c1p1); kSession.insert(p1); kSession.fireAllRules(); So far so good. The rules I have in my session are the following: declare Parent @propertyReactive end query getChildWithName(String $parentId, String $name, Child $child) $child:= Child(parentId == $parentId, name == $name) end rule Insert Children when $p: Parent()@watch(!*) $c: Child() from $p.children then System.out.println(Inserting child +$c); insert($c); end rule Rule A when $p: Parent(attribute2 != null) ?getChildWithName($p.attribute2, n1, $child;) then System.out.println(FOUND: +$child+. The attribute 'parentId' of this object must have the value '+$p.getAttribute2()+'. Does it? +$child.getParentId()+ == +$p.getAttribute2()+ ??); globalList.add($child); end rule Copy Attribute1 into Attribute2 when $p: Parent(attribute1 != null, attribute2 == null) then modify($p){ setAttribute2($p.getAttribute1()) } end The important part here is 'Rule A' and 'Copy Attribute1 into Attribute2'. The latter copies the value of attribute1 to attribute2 for any Parent object present in the session. (Note that the parent I'm inserting has attribute2 = null). 'Rule A' is then using a query to get a Child object that has a parent with id = $p.attribute2 (where $p is a previously matched Parent). Given that I only have 1 Parent in my session and that its id is '1' I don't expect 'Rule A' to be activated/executed. When I modify parent.attribute2 in 'Copy Attribute1 into Attribute2' I'm setting its value to 'a1'. 'Rule A' (via the query) should then look for a Child with parentid = 'a1' and It shouldn't find anything. Funny thing is that 'Rule A' activates and fires. The child object that is 'returned' by the query has a parentId of '1' so I don't know how this behavior is possible. If you take a look at the System.out output you will see that the activation makes no sense at all. Am I doing something wrong in my project? Is this a bug? Is this the expected behavior? Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Buggy query behavior in drools 5.6 and 6.1-SNAPSHOT ??
Indeed, the use case can be simplified further: package org.drools.test.bc; declare Parent attribute2 : String end declare Child parentId : String end query getChildWithName( String $parentId, Child $child ) $child:= Child( parentId == $parentId ) end rule Insert Children when then Parent p1 = new Parent( a1 ); Child c1p1 = new Child( 1 ); insert( c1p1 ); insert( p1 ); end rule Rule A when $p: Parent( $a2 : attribute2 ) ?getChildWithName( $p.attribute2, $child;) then System.out.println(FOUND: + $child ++ $child.getParentId() + == + $p.getAttribute2() + ?? ); end It has nothing to do with nested objects, @PR or modifications. It seems that the culprit is the chained property accessor. Davide On 01/22/2014 02:22 PM, Esteban Aliverti wrote: Hi guys, I was writing some rules using backward chaining and found a strange behavior. I managed to isolate the error in the test project I'm attaching. In the project I have 2 classes: Parent and Child Parent: * String id * String attribute1 * String attribute2 * ListChild children Child: * String parentId; * String name; * String value; In the test I'm creating 1 Parent object with just 1 child and then inserting the Parent object into a drools session: Parent p1 = new Parent(); p1.setId(1); p1.setAttribute1(a1); p1.setAttribute2(null); Child c1p1 = new Child(); c1p1.setName(n1); c1p1.setParentId(p1.getId()); c1p1.setValue(v1.1); p1.addChild(c1p1); kSession.insert(p1); kSession.fireAllRules(); So far so good. The rules I have in my session are the following: declare Parent @propertyReactive end query getChildWithName(String $parentId, String $name, Child $child) $child:= Child(parentId == $parentId, name == $name) end rule Insert Children when $p: Parent()@watch(!*) $c: Child() from $p.children then System.out.println(Inserting child +$c); insert($c); end rule Rule A when $p: Parent(attribute2 != null) ?getChildWithName($p.attribute2, n1, $child;) then System.out.println(FOUND: +$child+. The attribute 'parentId' of this object must have the value '+$p.getAttribute2()+'. Does it? +$child.getParentId()+ == +$p.getAttribute2()+ ??); globalList.add($child); end rule Copy Attribute1 into Attribute2 when $p: Parent(attribute1 != null, attribute2 == null) then modify($p){ setAttribute2($p.getAttribute1()) } end The important part here is 'Rule A' and 'Copy Attribute1 into Attribute2'. The latter copies the value of attribute1 to attribute2 for any Parent object present in the session. (Note that the parent I'm inserting has attribute2 = null). 'Rule A' is then using a query to get a Child object that has a parent with id = $p.attribute2 (where $p is a previously matched Parent). Given that I only have 1 Parent in my session and that its id is '1' I don't expect 'Rule A' to be activated/executed. When I modify parent.attribute2 in 'Copy Attribute1 into Attribute2' I'm setting its value to 'a1'. 'Rule A' (via the query) should then look for a Child with parentid = 'a1' and It shouldn't find anything. Funny thing is that 'Rule A' activates and fires. The child object that is 'returned' by the query has a parentId of '1' so I don't know how this behavior is possible. If you take a look at the System.out output you will see that the activation makes no sense at all. Am I doing something wrong in my project? Is this a bug? Is this the expected behavior? Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Inconsistent output when @PropertyReactive is used
Actually (and arguably) I think that the behavior is consistent. In the first case, you insert a MyClass instance: base is eligible for activation, and so is rule 1. When rule 1 fires, it inserts a String which continues the previous propagation through rule 2. At this point, value is still != test and an activation for rule 2 is created. Now the modify: since the only @PR pattern is MyClass( data == null ) in rule base and you are setting the property value, the (re)propagation is blocked. This prevents the previous activation of rule 2 from being overwritten and cancelled, so rule 2 fires. In the second example, things are slightly different. Rule 1 activates as in the previous case, firing. This time, you modify m first, but since no String is in the WM, there is nothing to (re)propagate or cancel for rule 2. However, there is indeed a MyClass instance in the WM. When you insert the String, the modification has already been propagated: this time the String simply joins with the existing MyClass and continues its propagation. The next node is a from which checks the current value: it is now test, so the alpha constraint blocks the propagation. Rule 1 does not fire as expected, but it has little do do with @PR. Davide On 01/16/2014 12:33 AM, Sonata wrote: Below is a test to demonstrate it, also add the @PropertyReactive property to MyClass() package com.sample; rule base when m : MyClass(data == null) then end rule 2 extends base when String() MyClass(value != test) from m then System.out.println(2 fired); end rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); insert(new String()); modify(m) { setValue(test) } end The test above should output 1 fired and 2 fired. Although we have set the value to test, rule 2 supposes to not fire, but it is in fact expected to fire due to the non-reactive property of CE from, and the result confirms this. But if we reorder the code in rule 1 to rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); modify(m) { setValue(test) } insert(new String()); end Then you get only 1 fired, as if CE from is reactive again. This only happens when you have the @PropertyReactive property added to MyClass() Version tested are 5.5.0.Final and 5.6.0.Final Could the Drools team review this? Thank you. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.6.0.CR1 gives a NullPointerException in after evaluator
This is unlikely to be the same exception that started the initial thread, but a problem nevertheless.. :( could you create a self-contained test case and submit it? Thanks Davide On 01/13/2014 08:05 AM, Mark Proctor wrote: That was recreated on 5.6.0.CR1 ? The 5.6 ship has sailed now :( and currently there are no plans for 5.7 any time soon. We should focus on making sure this is fixed in 6.x. Mark On 12 Jan 2014, at 19:21, nxv nxvanderlin...@gmail.com mailto:nxvanderlin...@gmail.com wrote: Hello, I'm able to reproduce this issue with a KB containing only 1 rule. rule Qualification##ToControl salience 50 when $p: AccessRegisterSnapshot( $effDt: effectivedate ) $dpo: DeliveryPoint() $gCfg: GeneralConfig( ( todate == null || ( todate after[ 0d ] $effDt todate after[ 1ms ] fromdate ) ) ) from $dpo.generalConfigs then end This rule worked under drools 5.5.0.Final. Caused by: java.lang.NullPointerException at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluate(AfterEvaluatorDefinition.java:347) at org.drools.base.EvaluatorWrapper.evaluate(EvaluatorWrapper.java:99) Davide Sottara wrote I tried to reproduce the problem, with no success. Could you please create a self-contained unit test? If confirmed, I'll fix the problem as soon as possible Thanks Davide On 11/14/2013 04:48 AM, abr wrote: Hi everyone, I tried to switch from 5.5.0.Final to 5.6.0.CR1 and got a null pointer exception in the evaluation of the after evaluator. (Exact method is: /org.drools.base.evaluators.AfterEvaluatorDefinition.AfterEvaluator.evaluate(InternalWorkingMemory, InternalReadAccessor, InternalFactHandle, InternalReadAccessor, InternalFactHandle)/ ) When debugging, the exception occurs at the very first line of the method, in: /if ( extractor1.isNullValue( workingMemory, handle1.getObject() ) || extractor2.isNullValue( workingMemory, handle2.getObject() ) ) { return false; } / The cause of the exception is that handle1 is null. The rule where the exception occurs looks like: /MyFact( fromdate before[ 0d ] $min, ( todate == null || todate after[ 0d ] $max ) ) / When the exception occurs, /MyFact.fromdate/ is not null, /$min/ is not null, /MyFact.todate/ is null, /$max/ is not null. In AfterEvaluator.evaluate : /extractor1/ refers to /MyFact.todate/, /extractor2/ refers to /$max/, /handle1/ is null, /handle2/ refers to the fact including the attribute to which /$max/ variable is bound to. Of course, this worked fine in 5.5.0.Final. I couldn't test this out in Drools 6.0.0.CR5 because I have dependencies to drools-spring JAR that does not exist anymore in 6.0.0.CR5. Is it simple to fix this problem? Thanks in advance. Best, Alexis -- View this message in context: http://drools.46999.n3.nabble.com/5-6-0-CR1-gives-a-NullPointerException-in-after-evaluator-tp4026780.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://drools.46999.n3.nabble.com/5-6-0-CR1-gives-a-NullPointerException-in-after-evaluator-tp4026780p4027661.html Sent from the Drools: User forum mailing list archive at Nabble.com http://nabble.com/. ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] forall is satisfied when there is nothing?
Logic and common sense do not always fit well together, and that's why fallacies plague discussions and argumentations... When we say forall... we typically mean forall... and exists... and we take the latter for granted, which can't be implicitly assumed e.g. by the rule engine. Likewise, think of vacuous implications : if donkeys could fly then (anything you want here) these are trivially true, too Davide On 01/08/2014 09:28 AM, Wolfgang Laun wrote: On 08/01/2014, Davide Sottara dso...@gmail.com wrote: Indeed it is true by convention, see also http://en.wikipedia.org/wiki/Universal_quantification The only other alternative is to deprecate quantifiers altogether ;) Ah, *by convention*, yes. One should exercise some care with vacuous truths, however. Uttering statements such as All the little green men in my room are from Mars may not brand you as a liar, but you could be called batty. ;-) -W Davide On 01/07/2014 11:53 AM, Wolfgang Laun wrote: Please comment on http://en.wikipedia.org/wiki/First-order_logic#Empty_domains -W On 07/01/2014, Davide Sottara dso...@gmail.com wrote: First order logic does permit empty domains, and the universal quantifier evaluates to true in that case. Davide On 01/07/2014 11:11 AM, Wolfgang Laun wrote: It is true that first-order logic usually assumes that the domain of a formula be a nonempty set. As so often, things aren't quite so simple when formulae are evaluated on a computer. What should be done in this case, forall with an empty domain? Throw an exception? Not very convenient, since there's no reasonable way of handling exceptions thrown on the LHS. Return false? That doesn't make sense, because you can't inspect what isn't there. Return true? If it isn't false - what else? If first-order logic does permit empty domains, it must be treated as a special case. -W On 07/01/2014, Sonata plz.write...@gmail.com wrote: Hi, I am using the forall keyword on the LHS and it seems the condition is satisfied when there is nothing to match. e.g. forall (MyClass(value == test)) fires the rule when there is no MyClass() object in the working memory. My workaround is add exists (MyClass()). Also, same for not (exists (MyClass(value != test))), but I can understand this, as there is no MyClass() object, it doesn't exists and hence not gives true. But for forall, it doesnt sound right to me. I wonder if forall is actually implemented as not exists in the engine. Please clarify if this is by design or a bug. Build is 5.5.0.Final Thank you -- View this message in context: http://drools.46999.n3.nabble.com/forall-is-satisfied-when-there-is-nothing-tp4027553.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] forall is satisfied when there is nothing?
The rule engine is still trying to approximate logic, even if not completely in a mathematical sense. One property quantifiers have to obey is DeMorgan's laws, so forall ... should be logically equivalent to not exists .. such that not..., which in Drools becomes for example : forall Cloth( dry ) - not Cloth( ! dry ) if forall returned false on an empty set, the equivalence would no longer hold. Notice that there is a second negation inside the pattern. (btw, the not CE has the semantics of not exists) This is actually the way it is implemented internally, and no, I don't think that it would be appropriate to change it. Davide On 01/08/2014 12:32 PM, Sonata wrote: laune wrote On 08/01/2014, Davide Sottara lt; dsotty@ gt; wrote: Indeed it is true by convention, see also http://en.wikipedia.org/wiki/Universal_quantification The only other alternative is to deprecate quantifiers altogether ;) Ah, *by convention*, yes. One should exercise some care with vacuous truths, however. Uttering statements such as All the little green men in my room are from Mars may not brand you as a liar, but you could be called batty. ;-) -W Davide Guys, I am not sure whats the arguing point here. But from a programmer's and a Drools engine user's perspective, I would find forall(void) to return false more convenient. Say for example: forall(Cloth(dried)) then collect() Programmingwise, I dont want to execute collect() when the Cloth() collection is empty and do extra null checkings. Performancewise, I also dont want to call collect() when there is actually nothing to perform. In terms of semantics, I purposely want to check for isDried is true, it is easy to realize from the LHS that I only want to collect clothes when all of them are dried, rather than I want to collect also empty air. On the contrary, if I really want to do the RHS even though the LHS has nothing, I would have written: not( exists( Customer() ) ) then takeanap() and I will not write forall( Customer(status == gone) ) then takeanap() because the latter needs to do extra property visits and string comparisons and it is so indirect to express what I really want. I really dont care what the mathematical definition is unless you tell me Drools is a math. engine rather than a rule engine to express business requirements. That, I should update myself and take a step back to look at Drools again. Just my own opinion :P -- View this message in context: http://drools.46999.n3.nabble.com/forall-is-satisfied-when-there-is-nothing-tp4027553p4027593.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] forall is satisfied when there is nothing?
The all and some combination is actually quite popular and might be implemented at some point. By no means it is the only possibility to enhance the expressivity of the language: http://plato.stanford.edu/entries/generalized-quantifiers/ On 01/08/2014 01:50 PM, Sonata wrote: Davide Sottara wrote This is actually the way it is implemented internally, and no, I don't think that it would be appropriate to change it. Yes I agree, so may be we users actually do not need forall, but *every*, which just means forall and exists Now, look at it again: when every Cloth( dried ) then collect() See how pretty it is, simple beauty, fully expressive, just like a sentence :) as oppose to when forall Cloth ( dried ) AND exists Cloth() then collect() X( Nah, I guess people can live with that :P -- View this message in context: http://drools.46999.n3.nabble.com/forall-is-satisfied-when-there-is-nothing-tp4027553p4027598.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] forall is satisfied when there is nothing?
First order logic does permit empty domains, and the universal quantifier evaluates to true in that case. Davide On 01/07/2014 11:11 AM, Wolfgang Laun wrote: It is true that first-order logic usually assumes that the domain of a formula be a nonempty set. As so often, things aren't quite so simple when formulae are evaluated on a computer. What should be done in this case, forall with an empty domain? Throw an exception? Not very convenient, since there's no reasonable way of handling exceptions thrown on the LHS. Return false? That doesn't make sense, because you can't inspect what isn't there. Return true? If it isn't false - what else? If first-order logic does permit empty domains, it must be treated as a special case. -W On 07/01/2014, Sonata plz.write...@gmail.com wrote: Hi, I am using the forall keyword on the LHS and it seems the condition is satisfied when there is nothing to match. e.g. forall (MyClass(value == test)) fires the rule when there is no MyClass() object in the working memory. My workaround is add exists (MyClass()). Also, same for not (exists (MyClass(value != test))), but I can understand this, as there is no MyClass() object, it doesn't exists and hence not gives true. But for forall, it doesnt sound right to me. I wonder if forall is actually implemented as not exists in the engine. Please clarify if this is by design or a bug. Build is 5.5.0.Final Thank you -- View this message in context: http://drools.46999.n3.nabble.com/forall-is-satisfied-when-there-is-nothing-tp4027553.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users