Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1095975

Summary: Kie Scanner won't pick up local maven jars when no remote repository available
Product: [Retired] JBoss BPMS Platform 6 Reporter: David Tucker <dtucker>
Component: jBPM CoreAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.1CC: abaxter, dtucker, etirelli
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:09:29 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
kie-maven-settings.xml used for business-central
none
KIE-CI standalone client none

Description David Tucker 2014-05-09 01:45:46 UTC
Description of problem:

When using the KieScanner with only a local maven repository available and no remote repositories at all (including BPMS) the Kie scanner won't pick up the local jars with the following exception:

java.lang.RuntimeException: Cannot find KieModule: <group>:<artifact>:LATEST
        at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:108)
        at com.railinc.bpms.engine.impl.provider.KieContainerProvider.createKieContainer(KieContainerProvider.java:33)
        at com.railinc.bpms.engine.impl.provider.KieContainerProvider.getKieContainer(KieContainerProvider.java:25)
        at com.railinc.bpms.engine.impl.provider.KieBaseProvider.createKieBase(KieBaseProvider.java:26)
        at com.railinc.bpms.engine.impl.provider.KieBaseProvider.getKieBase(KieBaseProvider.java:20)
        at com.railinc.bpms.engine.impl.provider.RuntimeEnvironmentProvider.getRuntimeEnvironment(RuntimeEnvironmentProvider.java:43)
        at com.railinc.bpms.engine.impl.provider.RuntimeManagerProvider.createRuntimeManager(RuntimeManagerProvider.java:27)
        at com.railinc.bpms.engine.impl.provider.RuntimeManagerProvider.getRuntimeManager(RuntimeManagerProvider.java:21)
        at com.railinc.bpms.engine.impl.provider.RuntimeEngineProvider.createRuntimeEngine(RuntimeEngineProvider.java:18)
        at com.railinc.bpms.engine.impl.provider.KieSessionProvider.createKieSession(KieSessionProvider.java:15)
        at com.railinc.bpms.engine.impl.ProcessServiceImpl.start(ProcessServiceImpl.java:53)
        at com.railinc.bpms.mediator.ProcessMediator.startProcess(ProcessMediator.java:39)
        at com.railinc.ddcts.service.incident.DDCTSProcessAwareService.start(DDCTSProcessAwareService.java:43)
        at com.railinc.ddcts.service.incident.impl.IncidentProcessServiceImpl.createIncident(IncidentProcessServiceImpl.java:88)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.railinc.ddcts.common.aop.TransactionWrapperAspect.invoke(TransactionWrapperAspect.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at com.railinc.ddcts.common.aop.TransactionWrapperAspect.invoke(TransactionWrapperAspect.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy107.createIncident(Unknown Source)
        at com.railinc.ddcts.incident.service.IncidentServiceImpl.createIncident(IncidentServiceImpl.java:790)
        at com.railinc.ddcts.incident.service.IncidentServiceImpl$$FastClassByCGLIB$$f7e7bcc9.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:627)
        at com.railinc.ddcts.incident.service.IncidentServiceImpl$$EnhancerByCGLIB$$f56df98f.createIncident(<generated>)
        at com.railinc.ddcts.web.incident.controller.EditIncidentController.save(EditIncidentController.java:716)
        at com.railinc.ddcts.web.incident.controller.EditIncidentController$$FastClassByCGLIB$$6a4c69e3.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.railinc.ddcts.web.common.aop.WebPerformanceAspect.capturePerformance(WebPerformanceAspect.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.railinc.ddcts.web.common.aop.ControllerPostProcessAspect.postProcess(ControllerPostProcessAspect.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.railinc.ddcts.web.common.aop.ControllerSessionAwareAspect.validateSession(ControllerSessionAwareAspect.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
        at com.railinc.ddcts.web.incident.controller.EditIncidentController$$EnhancerByCGLIB$$9ba35929.save(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

Version-Release number of selected component (if applicable):
6.0.1

How reproducible:
Consistent

Steps to Reproduce:
1) Have a settings.xml that points at BPMS
2) Run the application
3) Artifacts are all pulled down to m2 repo (I have a separate repo set up for the application using -Dkie.maven.settings.custom=/opt/m2ddcts/settings.xml
4) Shut down the application
5) Edit custom settings xml so the only thing inside is the <localRepository> configuration
6) Restart the application - at this point the m2ddcts repo has all of the artifacts already but there are no references to any external repo

Actual results:
Exception above

Expected results:
Application should run with no error

Additional info:

Comment 2 Marek Winkler 2014-05-12 14:20:19 UTC
I have reproduced the problem using the following steps:

1. start business-central with attached kie-maven-settings.xml (using these settings.xml might not be necessary)

2. in business-central, create a simple project with GAV group1:artifact1:1.0.0, and build it

3. run an attached reproducer with given settings.xml:

mvn clean test -Dtest=KieCIExternalRepoTest -Dkie.maven.settings.custom=settings.xml

4. comment out (or just disable) the <profile> part of the settings.xml

5. re-run the reproducer:

mvn clean test -Dtest=KieCIExternalRepoTest -Dkie.maven.settings.custom=settings.xml

I will attach the referenced attachments in a minute.

Comment 3 Marek Winkler 2014-05-12 14:31:39 UTC
Created attachment 894736 [details]
kie-maven-settings.xml used for business-central

Comment 4 Marek Winkler 2014-05-12 14:36:04 UTC
Created attachment 894741 [details]
KIE-CI standalone client

Comment 5 Marek Winkler 2014-05-12 14:40:02 UTC
Another option, how to reproduce this behaviour, is using pure Maven:

- try to build a project with dependencies which require declaring some remote repositories (as <repository> either in your pom.xml or settings.xml),

- then comment out the <repository> declaration and re-run the build,

- even though you already have all dependencies downloaded into your local maven repository, maven refuses to use them.

Having said that, it looks rather like a Maven feature than a bug in BRMS. The question is, how to achieve the use-case that David mentioned. Maybe use Maven offline mode?

Comment 6 Marek Winkler 2014-05-12 15:14:57 UTC
David, 

does the above make sense?

Could you please try your use-case:

- without removing the repository declaration from settings.xml,
- with specifying <offline/> element in the settings.xml? 

Thanks!

Comment 7 Marek Winkler 2014-05-12 15:34:27 UTC
David, 

to help us think of the best solution, what are you trying to achieve? Are you setting up a machine which will have no internet connection when put into production?

If so, the offline mode should help.

Thanks!

Comment 8 Geoffrey De Smet 2014-05-12 15:37:29 UTC
To generate a local repository that isn't hooked to a remote repository, use this plugin:
http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/using-repositories.html

Comment 9 Marek Winkler 2014-05-12 15:42:54 UTC
Based on previous comments, closing as not a bug. If you still experience issues with this, feel free to reopen this BZ.

Comment 10 David Tucker 2014-05-12 17:25:12 UTC
I've given this some thought and I feel like this still leaves us with a less than ideal solution.  This is the current deployment process:

1. Build kjar in Business Central
2. Jenkins pipeline installs kjar to appropriate environment (DEV,QA,Preprod,PROD)
3. Scanner picks up kjar

In offline mode, we have to have every transitive dependency available in the local repository on every environment.  With a scanner that only scans a disk location, all I need is the kjar.

I have code that is doing this now and it works.  I'm modifying our code to test the offline mode but I assume I am correct about the transitive dependencies.

Comment 11 David Tucker 2014-05-12 18:23:39 UTC
Just to update, I set my settings.xml to include <offline>true</offline> and this did not affect anything in regards to the KieScanner.  I left the remote repository configuration in the settings.xml and it still reached out to pull down the dependencies.

Once I removed the remote repository configuration, it again was unable to see the local files.

As I said above, I have done some work on a local scanner that uses the maven structure but does not actually rely on Maven.  This does seem to be less a bug and more a feature request at any rate.

Comment 12 Marek Winkler 2014-05-13 09:04:42 UTC
As far as I know, when Maven downloads an artifact into the local repository, it also associates this artifact with the repository id it had been downloaded from. Therefore, if you remove <repository> declaration from your pom.xml or settings.xml, you in fact tell maven not to use artifacts from that removed repository. This is the reason why removing <repository> declaration does not work. (This is probably new in Maven 3, I am not sure.)

Offline mode should help, it seems this might indeed be a bug in KIE-CI which is not parsing it (I filed a new BZ 1097148 for it).

Back to your scenario, if I understand correctly, your problem is related to transitive dependencies: you could probably use some local Nexus to hold all transitive dependencies, but then you would have to use one Nexus instance for each environment (DEV,QA,Preprod,PROD)?

Comment 13 David Tucker 2014-05-13 12:57:09 UTC
The scenario I describe would either require a local Nexus instance for the transitive dependencies for each environment or to have manually installed all transitive dependencies.  The goal of course is to have a minimal amount of those in a kjar and its imported jars but sometimes that's not possible.

Since we don't actually need those transitive dependencies (they're just a side effect of Maven pulling down the kjar) while the <offline> tag is helpful, it would be even better if the application could entirely ignore them.

Comment 14 Edson Tirelli 2015-01-29 01:56:12 UTC
As per comments above, moving this to 6.2.0 to be considered as a feature enhancement.