Bug 1303018

Summary: Cannot find KieModule with LATEST
Product: [Retired] JBoss BRMS Platform 6 Reporter: Suresh Pritmani <spritman>
Component: Business CentralAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Tomas David <tdavid>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2.0CC: lpetrovi, tdavid
Target Milestone: DR2   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1304051 (view as bug list) Environment:
Last Closed: 2020-03-27 19:12:38 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:
Bug Depends On:    
Bug Blocks: 1304051    

Description Suresh Pritmani 2016-01-29 10:15:02 UTC
Description of problem:

Customer is trying to access KieJar using "LATEST" key word via KieScanner but if jar is built today, it's working and if jar is old (not built today) than it's not working.

This is similar bug filed on community.

https://issues.jboss.org/browse/DROOLS-465

Version-Release number of selected component (if applicable):
BRMS 6.1.0 and BRMS 6.2.0

How reproducible:
try to access any old kie-jar (not built today) via KieScanner using LATEST key word.

For Example :
public class SampleRuleExecution {
	
	private  static KieServices ks = null;
	private static  KieContainer contnrExceptionLD = null;
	
	public static void main(String[] args){
		try{
	    	ks = KieServices.Factory.get();
	    	
	    	ReleaseId releaseId = ks.newReleaseId("example", "SampleProject", "LATEST"); //6.1.0
	    	System.out.println("releaseId : " + releaseId.getGroupId() + " : " + releaseId.getArtifactId() + " : " + releaseId.getVersion() );
			contnrExceptionLD = ks.newKieContainer(releaseId);
    	}catch(Exception e){
    		e.printStackTrace();
    	}
	}
}

Actual results:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.RuntimeException: Cannot find KieModule: example:SampleProject:LATEST
	at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
	at com.sample.SampleRuleExecution.main(SampleRuleExecution.java:24)



Expected results:
Latest KieJar should be accessed from local maven repository.

Additional info:

Following are few more findings while working on this issue.

- If I am trying to access KieJar from sample java code via Kie-Scanner using "LATEST" key word and if the jar is built recently (today) than it is working properly where as if the project is not built today than kie-scanner is not considering the old jar (which is previously built and not built today) and facing this issue on BRMS 6.1.0 and 6.2.0.
 
- One more finding : If the "maven-metadata-loacl.xml" file is being updated manually by changing value of "lastUpdated" tag with latest value than it's working fine and in this scenario, it's not required to re-build the jar.
 
- While accessing jar from sample code (jar with old timestamp), than "maven-metadata-loacl.xml" is being removed from local repository and if you create new meta-data file than it's working fine.

Comment 2 Petr Kočandrle 2016-01-29 11:28:12 UTC
I believe this is a problem in Business Central and not in the product Maven Repository delivered via CSP / hosted at maven.repository.redhat.com.

Comment 3 Suresh Pritmani 2016-02-02 12:15:51 UTC
As per SRM's request, prioritizing the bug request.

Comment 4 Mario Fusco 2016-02-04 11:50:53 UTC
The suggestion reported here https://issues.jboss.org/browse/DROOLS-465 (avoiding to add the local repository among the remote ones) actually prevents the maven-metadata.xml file to be removed and it fixes this issue as reported. Unfortunately this solution breaks the retrieval of newly deployed SNAPSHOTs while the KieScanner is running. 

I'm trying to figure out why and how to fix this problem without breaking SNAPSHOTs resolution.

Comment 5 Mario Fusco 2016-02-10 14:18:16 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/183bf11f7

Comment 6 Tomas David 2016-03-24 06:02:17 UTC
Verified with 6.3.0.ER1.