Guvnor causes NoClassDefFoundError when using functions
by Andrew Nguyen
Hello all,
I have been using Guvnor to manage some rules in a prototype system
that we are developing. If I login to Guvnor, make some changes, and
rebuild the package, sometimes I will get the following error:
java.lang.NoClassDefFoundError: tpn/CompareBetween
I have a function defined that is "compareBetween" and the syntax and
everything looks correct in the generated DRL file. Sometimes, I can
rebuild the package (without making any changes) and the problem will
go away?
Has anyone seen anything like this before?
Thanks,
Andrew
--
Andrew Nguyen
Nguyen & Associates
Custom Software Development & IT Services
http://www.na-consulting.net
andrew(a)na-consulting.net
858-225-7575
16 years, 12 months
Changing timer properties
by Tom
Hi!
I am working with drools (flow) 5.1.snapshot. I have a timer node within my
workflow. Now I'm wondering if it's possible to change the timer delay
property from outside, or at runtime in an action node.
I tried to pass the delay-value as parameter to the process, and then set
the new timer delay, but this approach didn't have any effect,
unfortunately.
Assigning a variable name as delay (eclipse-GUI-property) doesn't work
either (value has to be a number!).
It would be cool if it was possible to parameterize the timer node BEFORE
process execution, therefore the process would be more generic.
Has anyone a idea, how I can get rid of this?
Cheers
tom !
16 years, 12 months
Another question on how to use map
by Brody bach
Hi,
I need to put a map into the working memory and make some check on the
values
I have an object called Student with Id
And for every student there is a list of activity.
Each activity has date and the time for the activity
What I will be putting in the working memory looks as follows:
List<Student> studentList = getStudentList();
Map<Student, List<Activity>> studentActivityMap =
getStudentActivities(studentList);
List objects = new ArrayList();
objects.add(studentList);
objects.add(studentActivityMap);
ksession.execute(objects);
====================
Now i need to check for every student, if there is/are activity(ies) which
needs more than 2 hours. If yes, give an output information which mention,
which student and on which day the activity is longer than 2 hours
when
$studentList : List
$std : Student($id : id) from $studentList
$activityList : ****how to get the list of activity for the student with
this $id from the given map *****
$act : Activity ($date : date, length > 180) from $activityList
then
(print something out using $id from std and $date from act)
Would really appreciate any help and hints here
Regards
bb
--
View this message in context: http://www.nabble.com/Another-question-on-how-to-use-map-tp24181278p24181...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 12 months
Group a list of objects in Drools
by Amila Silva
hi all,
I have requirement to group the list of objects in drl file.
I have list of events objects and i want group then by no of occurrences and
filter them that no of occurrences.
thanks
Amila
16 years, 12 months
Debug drl file is not working eclipse
by balachandra maddina
Hi There,
I tried debug a drl file in eclipse(3.4) but its not working not sure what
is required to get the debug enabled here. any help would be appreciated.
Thank you,
bala.
16 years, 12 months
RuleContext and insertLogical()
by Michal Bali
Hi,
The org.drools.runtime.rule.RuleContext doesn't support insertLogical() as
did the deprecated KnowledgeHelper. Is it planned to support this method in
the next release of Drools?
Thanking you in advance.
Best regards,
Michal
16 years, 12 months
unable to resolve method using strict-mode
by Chris Richmond
I cannot seem to call a static method on one of my classes and keep getting
this error:
[Error: Failed to compile: 1 compilation error(s):
- (1,44) unable to resolve method using strict-mode:
com.aps.syslog.logging.manager.LoggingManager.runLoggingTest(java.lang.Strin
g, com.aps.syslog.logging.Transaction)]
[Near : {... Unknown ....}]
When I call the static method:
LoggingManager.runLoggingTest ("23223", transaction);
Where the first argument can be any string and the second is a custom class
that I isntatiated earlier in the RHS with no problems.
Is the problem strict-mode? Or something else? LogginManager.runLoggingTest
is a static method but do I perhaps have to do something like:
$lm : LoggingManager()
Then call the static method using:
$lm.runLoggingTest ("23223", transaction);
Or something along these lines (I did try this but it failed as well).
Thanks,
Chris
16 years, 12 months
Class Cast Exception in Drools 4 Generated Accumulate Method
by Steve Ronderos
Hi Rules Users,
I'm experiencing an issue with a Drools 4.0.7 rule.
Here is a clip of the exception that is thrown:
Caused by: org.mvel.CompileException: cannot invoke method
at
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:54)
at
org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at
org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 80 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor412.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:46)
... 88 more
Caused by: org.drools.RuntimeDroolsException:
java.lang.ClassCastException: com.demo.Rule_My_Rule_0$Accumulate0
at org.drools.rule.Accumulate.accumulate(Accumulate.java:131)
at
org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:352)
at
org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:248)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:67)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:61)
... 92 more
Caused by: java.lang.ClassCastException:
com.demo.Rule_My_Rule_0$Accumulate0
at
com.demo.Rule_My_Rule_0Accumulate0Invoker.accumulate(Rule_My_Rule_0Accumulate0Invoker.java:43)
at org.drools.rule.Accumulate.accumulate(Accumulate.java:123)
... 103 more
The actually rule name and package are a lot longer, I changed them here
for brevity and because I don't believe the names themselves are relevant.
This exception is being thrown intermittently when this rule, which
contains an accumulate function is called. I say intermittently because
it does not happen every time the rule is run. As far as I can tell the
ClassCastExceptions only happens when the computer that the rules are
running on is under load.
A few more details before I post the rule itself. The rule base that I am
building consists of 2 drl files. Both of the files have the same package
declaration at the top. The 2 packages are built separately using
PackageBuilder then combined using RuleBase.addPackage() on both packages.
Also, I'm not sure if this is relevant, but this scenario takes place in
a web application where the two package objects are only built once (for
performance) but each user session creates a new RuleBase and adds the
packages. The individual sessions then create stateful sessions from the
rule base.
This is the rule that I believe is causing the issue.
rule "My Rule"
salience 50
dialect "java"
no-loop true
when
$module : Module( selected == false, required > 1, $size :
required )
$list : ArrayList( )
from accumulate( PotentialMatch( module == $module, $slot
: slot ),
init( List result = new ArrayList(); ),
action( result.add($slot); ),
reverse( result.remove((Integer)$slot ); ),
result( result ) )
eval( countThem($list, $size) != $module.setMatchCount() )
then
modify( $module ) { setMatchCount(countThem($list, $size)) };
end
As I'm typing this I realize that there is another way to write this rule
using collect. I'm not sure why it was written this way, but since I have
already come this far, has anyone had any experience with the Drools 4
generated code throwing ClassCastExceptions?
Thanks,
Steve Ronderos
17 years