[
https://issues.jboss.org/browse/DROOLS-1166?page=com.atlassian.jira.plugi...
]
Mario Fusco commented on DROOLS-1166:
-------------------------------------
Your test cases is a bit convoluted and I'm not sure why you're attempting this.
It seems that you found a ClassLoader problem caused by the anonymous inner class defined
in your function. I'm trying to figure out what's happening there. Also consider
that if you replace
{code}
function Function<Entry, Object> entryKey() {
return new Function<Entry, Object>() {
@Override
public Object apply(Entry e) {
return e.getKey();
}
};
}
{code}
with
{code}
function Function<Entry, Object> entryKey() {
return (Entry e) -> e.getKey();
}
{code}
it works as expected ... even if at the moment I'm not sure why :)
ClassNotFoundException for the drools function when large number of
valuations
------------------------------------------------------------------------------
Key: DROOLS-1166
URL:
https://issues.jboss.org/browse/DROOLS-1166
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 6.4.0.Final
Reporter: Matteo Mortari
Assignee: Mario Fusco
Priority: Minor
Attachments: 20160505.testjitfunction.zip
Hello, for a large number of evaluations a {{ClassNotFoundException}} is thrown missing
to find appropriate class for the drools function defined.
In the attached reproducer, a for loop inserts a given number of facts into the session;
for a small number of facts, no error is thrown.
For example given
{code}
for (int i=0; i<20; i++) {
session.insert("Ciao "+i);
session.fireAllRules();
}
{code}
all is fine.
When running with say:
{code}
for (int i=0; i<150; i++) {
session.insert("Ciao "+i);
session.fireAllRules();
}
{code}
then throws, snippet:
{code}
java.lang.NoClassDefFoundError: com/acme/testjitfunction/EntryKey$1
at com.acme.testjitfunction.EntryKey.entryKey(EntryKey.java:51)
at ConditionEvaluator1fae754676b54e869aa5b558ba2d7991.evaluate(Unknown Source)
at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:258)
at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:214)
at
org.drools.core.phreak.PhreakAccumulateNode.evaluateResultConstraints(PhreakAccumulateNode.java:696)
at org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:114)
at
org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:534)
[...]
Caused by: java.lang.ClassNotFoundException: com.acme.testjitfunction.EntryKey$1
at java.lang.ClassLoader.findClass(ClassLoader.java:530)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at
org.drools.core.common.ProjectClassLoader$DefaultInternalTypesClassLoader.loadType(ProjectClassLoader.java:393)
at
org.drools.core.common.ProjectClassLoader$DefaultInternalTypesClassLoader.loadClass(ProjectClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 44 more
{code}
I'm also wondering if maybe this is not the best possible way to "backport"
lambdas as a drool function; in case a more proper way to implement them as a drool
function is possible, kindly let me know.
Can you kindly advise, please?
Thank you very much
Ciao
MM
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)