Hide Forgot
Description of problem: The application and product bundles are resolved and installed in parallel in fabric (based on alphabetical ordering, if there is no dependency) and 100% of the time, the KieScanner Bundle Activator ends up running after the application has already failed. 2016-02-29 11:35:01,710 | ERROR | agent-1-thread-1 | BlueprintContainerImpl | container.BlueprintContainerImpl 398 | 8 - org.apache.aries.blueprint.core - 1.0.1.redhat-611423 | Unable to start blueprint container for bundle brms-service org.osgi.service.blueprint.container.ComponentDefinitionException: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean kieSessionService of class class com.redhat.drools.camel.beans.KieScannerKieSessionService ... ... Caused by: java.lang.RuntimeException: Cannot find KieModule: com.test.app:app-brms:1.0.0-SNAPSHOT ... ... Caused by: java.lang.RuntimeException: Cannot find KieModule: com.test.app:app-brms:1.0.0-SNAPSHOT ... 2016-02-29 11:35:03,132 | INFO | agent-1-thread-1 | DeploymentAgent | io.fabric8.agent.DeploymentAgent 953 | 58 - io.fabric8.fabric-agent - 1.0.0.redhat-424 | org.kie.scanner.osgi / 6.3.0.201602012307 2016-02-29 11:35:03,134 | INFO | agent-1-thread-1 | Activator | org.kie.scanner.Activator 38 | 1430 - org.kie.scanner.osgi - 6.3.0.201602012307 | registering kiescanner services 2016-02-29 11:35:03,135 | INFO | agent-1-thread-1 | Activator | i.Activator$DroolsServiceTracker 134 | 1426 - org.drools.compiler - 6.3.0.201602012307 | registering compiler : org.kie.scanner.KieScannerFactoryServiceImpl@4862f7d4 : interface org.kie.api.builder.KieScannerFactoryService 2016-02-29 11:35:03,143 | INFO | agent-1-thread-1 | Activator | i.Activator$DroolsServiceTracker 134 | 1426 - org.drools.compiler - 6.3.0.201602012307 | registering compiler : org.kie.scanner.MavenClassLoaderResolver@575df6d7 : interface org.kie.internal.utils.ClassLoaderResolver 2016-02-29 11:35:03,147 | INFO | agent-1-thread-1 | Activator | org.kie.scanner.Activator 45 | 1430 - org.kie.scanner.osgi - 6.3.0.201602012307 | kiescanner services registered Setting a break point at [1] shows the true cause because the only way I found loadArtifact returns null was from DummyKieScanner. A getCause on the exception object reveals a ClassNotFoundException because the KieScannerFactoryServiceImpl has not yet been loaded by the Bundle Activator. java.lang.Throwable.detailMessage: "Unable to instantiate 'org.kie.scanner.KieScannerFactoryServiceImpl'" java.lang.Throwable.cause: instance of java.lang.ClassNotFoundException(id=6377) As it stands, there is no way for an application to declare a dependency on KieScannerFactoryServiceImpl to ensure the Bundle Activator is run prior to an application being started. [1] https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L140 Version-Release number of selected component (if applicable): BRMS 6.2.x BRMS 6.3 How reproducible: 100% Steps to Reproduce: 1. Deploy any application which loads a KJAR in a fabric environment where the BRMS and Application bundles are loaded at the same time. Actual results: RuntimeException with 'Error when instantiating bean kieSessionService of class class com.redhat.drools.camel.beans.KieScannerKieSessionService' Expected results: Successful deployment Additional info:
Fixed by https://github.com/droolsjbpm/drools/commit/aebe63fab
Verified using BxMS 6.3.0.ER3 and JBoss Fuse 6.2.1. Now, it is possible to start a KJAR and product bundles at the same time.
Cherry-picked to branch 6.4.x with https://github.com/droolsjbpm/drools/commit/d2391b0b9
This bugzilla is very probably not fixed in 6.3.0.ER3 because of missing commit. I will need to do more investigation.