-
Bug
-
Resolution: Done
-
Critical
-
6.2.0
-
None
-
All All
+++ This bug was initially created as a clone of Bug #1323167 +++
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.
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:
— Additional comment from JBoss Product and Program Management on 2016-04-01 08:30:07 EDT —
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.
— Additional comment from Matthew Robson on 2016-04-01 08:30 EDT —
Customer log file, private.
Exception starts at:
2016-02-26 12:20:34,982 | 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
Which is before the Activator runs at:
2016-02-26 12:20:39,028 | INFO | agent-1-thread-1 | Activator | org.kie.scanner.Activator 38 | 1340 - org.kie.scanner.osgi - 6.3.0.201602012307 | registering kiescanner services
— Additional comment from Mario Fusco on 2016-04-07 11:33:00 EDT —
Fixed by https://github.com/droolsjbpm/drools/commit/aebe63fab