problem with pesisted stateful knowledge session and Length Sliding Window
by henrychen
Hi all,
I am facing a problem with persisted stateful knowledge
session, please help me. My rule is listed as below:
package com.sample
import com.sample.Event;
import java.util.List;
declare Event
@role(event)
end
rule "test"
when
$list : List() from collect(Event() over window:
length(2))
then
System.out.println("----print out in rule, size of
the list collected from window is:" + $list.size());
end
The problem is,
when use a normal stateful session(created by the calling
kbase.newStatefulKnowledgeSession()), *when a third fact inserted, the
session working memory only retains list of 2, as expected.*
when use a persisted stateful session(created by the calling
JPAKnowledgeService.newStatefulKnowledgeSession()), insert 2 facts first.
Then restore this session by
JPAKnowledgeService.loadStatefulKnowledgeSession(), and *insert a third
fact, the session working memory grows to list of 3?*
By the way, I am using version 5.2.0.Final. And after I upgrade
to version 5.4.0.Final, the test result of persisted session becomes to
normal.*The attachment is my test program and you can repeat it.*
I want to ask you if there is something missing that I need to
do in 5.2.0.Final?
Thank you in advance, any help will be appreciated.
http://drools.46999.n3.nabble.com/file/n4019766/drools-session-persis-dem...
drools-session-persis-demo.zip
--
View this message in context: http://drools.46999.n3.nabble.com/problem-with-pesisted-stateful-knowledg...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
exception jitting problem
by brendanneff
Hello,
I recently "inherited" drools management of our system when the previous
code owner left the company unexpectedly, and sure enough, as soon as he
left, I found the errors posted below. Being new to drools, I'm pretty lost
about how to begin troubleshooting this issue.
I read a few forum posts about updating to 5.4 CR1 (we're using 5.4 Final),
but wanted to ask and see if that's really the cause before I start changing
the version. I also saw that casting as an Integer, which we do, could
solve the problem. Could someone take a look at this and let me know if
changing to CR1 would fix the issue or if there's a simpler solution?
A little more info:
We recently started increasing our traffic, which may be why we didn't see
this issue before.
I can't tell if this happens every 21st call or not, as was noted in other
forum posts. We have multiple rules in each .drl file, and it seems like
only these two rules are referenced, and none of the others. All rules in
the file are called, so shouldn't the others cause the exceptions too?
As far as I can tell, we're passing valid values each time to the rules.
If there's any other information I can provide, please let me know.
Thanks
Exception in thread "Thread-69" java.lang.RuntimeException: Exception
jitting: !getActiveLender($loan.getCurrentLender().getName()).canMakeLoan
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.VerifyError: (class:
ConditionEvaluator30c1aafd8a5c4402813396a1ab9f4739, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.getConstructor(Class.java:1674)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
... 5 more
Exception in thread "Thread-70" java.lang.RuntimeException: Exception
jitting: new Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.VerifyError: (class:
ConditionEvaluatorcc9abc72a67b4dd2bbde979a1a2baa48, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.getConstructor(Class.java:1674)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
... 5 more
Here are the rules that seem to be causing the errors:
rule "Cashcure - Average Monthly Income Less Than 1251"
when
$loan : CMVNewLoanBean( new
Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251)
then
$loan.setLenderError($loan.getCurrentLender().getName(), 20253);
end
rule "Cashcure - Loan Cap Has Been Reached"
when
$loan : CMVNewLoanBean(
!getActiveLender($loan.getCurrentLender().getName()).canMakeLoan )
then
$loan.setLenderError($loan.getCurrentLender().getName(), 20259);
end
--
View this message in context: http://drools.46999.n3.nabble.com/exception-jitting-problem-tp4019764.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools - Search and Reporting
by dme1
Hi,
Is there any way to search and/or generate reports from the Rule Repository
based on different criteria like Facts, Field Values, Attributes, MetaData
etc.
E.g. If I have a rule
rule "Test"
when
@SomeMetaData("value1")
ruleflow-group "abcd"
p : Person (age > 25, country = "XYZ")
then
p.setSomeField("value");
I would like to search for all rules in the ruleflow-group abcd, and
MetaData=SomeMetaData;
or for rules which are defined for Person with age as a criteria; or for
Person with age > 25 etc.
I would like to do this in Guvnor and Eclipse if possible.
If the features do not exist what would be the best way to write a custom
search feature to satisfy this requirement.
Thanks,
dme.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Search-and-Reporting-tp4019747.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Package footprint
by JP Chemali
Hi all,
I'm trying to reduce the memory footprint of packages in my application (for
performance reasons they are dynamically loaded from disk), and I was
wondering if some of you had any experience with the subject?
So far the optimizations that I can come up with in 5.4.0.Final version are
all about reducing the sizes of generated classes:
- Package name in the drl file should be as small as possible, one letter is
best (even better that no package at all)
- Rule name should be as small as possible as it is used to generate the
consequence class name
- Write as less code as possible in the consequence
- Use as few as possible eval statements
- By using my own JavaDialectConfiguration and MVELDialectConfiguration when
building the knowledge, I can remove the random number on class names that
was added in the recent versions (don't understand why it was added in the
first place? Does anyone know?)
I see some leeway to shorten the names of the following generated classes
but the amount of overriding to change the "default" consequence name and
the suffixes is a bit too exotic for me:
- <PackageName>.<RuleName>DefaultConsequenceInvoker
- <PackageName>.<RuleName>DefaultConsequenceInvokerGenerated
Any advice, other leads some of you might have?
Thanks in advance
--
View this message in context: http://drools.46999.n3.nabble.com/Package-footprint-tp4019721.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
ETA on Drools Planner 5.5 beta?
by Michiel Vermandel
Hi,
I have a pending issue that should be solved in Drools Planner 5.5 Beta.
(WARN : [2012-09-07 14:56:40,252] Cancelled step index (0), time spend (18375): there is no doable move. Terminating phase early.)
I was informed that Drools Planner 5.5 Beta would be released one of these days.
Any concrete delivery date available?
I have a demo to give next week and would like to test my project on 5.5 to see all is the same or better.
Thanks a lot,
Michiel Vermandel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
12 years, 3 months
How does 'from' cache works?
by Esteban Aliverti
Assuming I have the following rule:
global SomeClient client;
rule "Poll Values"
timer (int: 0s 1s)
when
$data: Data() from client.getData();
then
insert($data);
end
and that I'm just creating a session with just that rule, setting the
global and calling fireAllRules(). And let's say that my session is running
for 5 seconds.
My questions are:
1.- How many times is the rule going to be executed?
2.- How many times is client.getData() going to be invoked?
The test I have shows that the rule is executed 5 times,
but client.getData() is only invoked for the first activation. The returned
object is used in the subsequent activations. Is this the expected behavior?
As the rule name states, I'm expecting to get some (different) values from
client every second.
I understand that I'm doing 'strange' things since the rule doesn't use any
real fact but I would like to understand why I'm experiencing the described
behavior.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
12 years, 3 months
Drools Memory Log getting over written
by himansu.nayak
Hi,
i am trying to append my memory log generated by drools rule engine. but
each time
i run the code the log just get overwritten. is there any way to avoid
overwritten of my log.
this is the code i am using for my log generation.
type 1
---------
WorkingMemory workingMemory = ruleBase.newStatefulSession();
WorkingMemoryFileLogger wmLogger = new WorkingMemoryFileLogger(
workingMemory);
wmLogger.setFileName("log/xyz");
.
.
.
wmLogger.writeToDisk();
type 2
---------
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory
.newFileLogger(ksession,
log/xyz.log);
ksession.addEventListener(CustomAgendaEventListener.getInstance());
ksession.addEventListener(CustomWorkingMemoryEventListener
.getInstance());
.
.
.
.
logger.close();
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Memory-Log-getting-over-written-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months