[jboss-jira] [JBoss JIRA] (DROOLS-1166) ClassNotFoundException for the drools function when large number of valuations

Mario Fusco (JIRA) issues at jboss.org
Thu May 5 10:39:00 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-1166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201642#comment-13201642 ] 

Mario Fusco commented on DROOLS-1166:
-------------------------------------

Using the lambda inside the function works because it uses the java.lang.invoke.LambdaMetafactory instead of looking for the inner class. 
This is really a extreme edge case and I'm not sure if we want to support this, but I'll keep investigating a bit more.

> 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)


More information about the jboss-jira mailing list