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

Bug 1323167

Summary: Drools Service Dependency in Fuse fabric
Product: [Retired] JBoss BPMS Platform 6 Reporter: Matthew Robson <mrobson>
Component: Fuse IntegrationAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Jiri Petrlik <jpetrlik>
Severity: high Docs Contact: Petr Penicka <ppenicka>
Priority: high    
Version: 6.2.0CC: lpetrovi, mrobson
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1325017 (view as bug list) Environment:
Last Closed: 2020-03-27 20:00:06 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: 1325017    

Description Matthew Robson 2016-04-01 12:28:37 UTC
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:

Comment 3 Mario Fusco 2016-04-07 15:33:00 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/aebe63fab

Comment 5 Jiri Petrlik 2016-04-19 14:14:41 UTC
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.

Comment 6 Mario Fusco 2016-04-26 07:25:44 UTC
Cherry-picked to branch 6.4.x with https://github.com/droolsjbpm/drools/commit/d2391b0b9

Comment 7 Jiri Petrlik 2016-04-26 14:48:15 UTC
This bugzilla is very probably not fixed in 6.3.0.ER3 because of missing commit. I will need to do more investigation.