Bug 1026311

Summary: KieScanner does not recognize presence of a new class file in Jar
Product: [Retired] JBoss BRMS Platform 6 Reporter: Tomas David <tdavid>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas David <tdavid>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0CC: etirelli
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:58:25 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:

Description Tomas David 2013-11-04 11:56:06 UTC
Description of problem:
KieScanner does not recognize presence of a new class file in Jar, when new Jar is deployed, and kieSession still works with old class file.

Version-Release number of selected component (if applicable):
Drools 6.0.0-SNAPSHOT
Drools 6.0.0.ER4

How reproducible:
Pull request #278 submited in Drools.

Steps to Reproduce:
1. Write a test with KieScanner for specific KieContainer. Deploy artifact with module that contains rule file and class file. Class file contains one class with one static method that returns some number. Rule file contains one rule. Rule adds returned value from the static method to global variable. Create new KieSession from KieContainer and check that the number is returned.
2. Deploy new artifact with module that contains same rule and class file with method that returns some other number. Create new KieSession from KieContainer and check that the new number is returned.
3. Run test.

Actual results:
Old value is returned.

Expected results:
New value should be returned.

Additional info:

Comment 2 Mario Fusco 2013-11-04 15:14:15 UTC
We were already aware of this issue and the fix could be very difficult. The main problem is that the old Java class is loaded in the class loader and it is not possible to remove it form there and replace with a new one. We should create a way to dump the old class loader, but this cannot work if the KieBase already exists.

Comment 3 Mario Fusco 2013-11-27 09:55:16 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/275e7afd7

Comment 4 Tomas David 2014-01-13 09:42:20 UTC
Tested on BRMS 6.0.0.ER7, but it still doesn't work for me.

KieRepositoryScannerTest.testKScannerWithKJarContainingClasses works fine, but test from Pull request #278 still fails.

Comment 5 Mario Fusco 2014-01-14 11:36:57 UTC
This problem arises when only java classes are changed but not the drls using them.

Fixed by https://github.com/droolsjbpm/drools/commit/e4fb59716

Comment 6 Lukáš Petrovický 2014-02-07 16:19:10 UTC
This no longer has a target release of 6.0.0.

Comment 7 Tomas David 2014-02-18 14:27:20 UTC
Verified on BRMS 6.0.1.ER1.