Bug 1089083
| Summary: | ClassNotFoundException when using Accumulate function | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Thiago Araki <taraki> | ||||
| Component: | BRE | Assignee: | Edson Tirelli <etirelli> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Marek Winkler <mwinkler> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 6.0.1 | CC: | kverlaen, lpetrovi, mbaluch, mfusco, rrajasek | ||||
| Target Milestone: | ER3 | ||||||
| Target Release: | 6.0.2 | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-08-06 19:53:12 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
The problem happens when the rule with the accumulate function is loaded from a kjar with cached classes. So the easiest way to reproduce it is creating a kjar with a drl containing a rule with an accumulate function and, install it in your local maven repo and load it into another project using its releaseId. What happens in this case is that the bytecode of the generated classes stored in the cache of the kjar is used, but this doesn't work for inner classes ( like the org.acme.insurance.policyquote.Rule_PriceMultipleVehicles291846635$Accumulate0 of the failing test ) even if that bytecode is also in the cache. The most robust way to fix this will be to change the structure of the cache of each package from Map<String, byte[]> to Map<String, List<byte[]>> in order to index the bytecodes of both the outer class and all the eventual inner classes for a given java source. Edson will implement this change so I am reassigning this ticket to him. Rajesh, This ticket is a blocker as it breaks any application that includes a rule with a custom accumulate. I pushed the fix: (master): http://github.com/droolsjbpm/drools/commit/cd81cc464 (6.0.x): http://github.com/droolsjbpm/drools/commit/d89b22332 Verified on BRMS 6.0.2 ER3. |
Created attachment 887334 [details] Resources described in "Additional Info" field. Description of problem: ClassNotFoundException when using Accumulate function in a DRL rule AND the Java project creates the KieContainer by referencing the maven repository JAR with newKieContainer( ReleaseId ) approach. Version-Release number of selected component (if applicable): Drools 6.0.0.Final and 6.0.1.Final How reproducible: Easy Steps to Reproduce: 1. Create, build and deploy a BRMS project with a Rule that contains an Accumulate function 2. Create a Java project which imports the BRMS asset JAR using newKieContainer( ReleaseID ) approach 3. Execute the Java project Actual results: java.lang.ClassNotFoundException: org.acme.insurance.policyquote.Rule_PriceMultipleVehicles291846635$Accumulate0 at org.drools.core.common.ProjectClassLoader.tryDefineType(ProjectClassLoader.java:123) [drools-core-6.0.1.Final.jar:6.0.1.Final] at org.drools.core.common.ProjectClassLoader.loadType(ProjectClassLoader.java:114) [drools-core-6.0.1.Final.jar:6.0.1.Final] at org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:84) [drools-core-6.0.1.Final.jar:6.0.1.Final] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [rt.jar:1.7.0_51] at org.drools.core.rule.JavaDialectRuntimeData$PackageClassLoader.loadClass(JavaDialectRuntimeData.java:643) [drools-core-6.0.1.Final.jar:6.0.1.Final] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [rt.jar:1.7.0_51] at org.acme.insurance.policyquote.Rule_PriceMultipleVehicles291846635Accumulate0Invoker.createContext(Rule_PriceMultipleVehicles291846635Accumulate0Invoker.java:13) at org.drools.core.rule.Accumulate.createContext(Accumulate.java:126) [drools-core-6.0.1.Final.jar:6.0.1.Final] at org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:145) [drools-core-6.0.1.Final.jar:6.0.1.Final] ... Expected results: Rule should execute correctly Additional info: The attached file contains the following resources: The zip files below can be used to reproduce my scenario: * acme.zip: maven repository with the BRMS asset JAR. Should be placed in .m2/repository/org/ * insurancepolicy.zip: cloned BRMS git repository * jboss-as-helloworld.zip: web project The accumulate-test-project.zip file is another Java project with the same rule, but this time the DRL is created directly in JBoss Developer Studio and the KieContainer is created using getKieClasspathContainer() approach. This project works correctly.