Bug 1310039

Summary: Kie-Aries-Blueprint fails to create a KieBase importing classes from another bundle
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: Fuse IntegrationAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact: Petr Penicka <ppenicka>
Priority: urgent    
Version: 6.2.0CC: alazarot, kverlaen, lpetrovi, rrajasek
Target Milestone: ER2   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1310714 (view as bug list) Environment:
Last Closed: 2020-03-27 20:11:01 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: 1310714    
Attachments:
Description Flags
Exception stacktrace none

Description Marek Winkler 2016-02-19 10:08:27 UTC
Created attachment 1128499 [details]
Exception stacktrace

Description of problem:
When using kie-aries-blueprint for defining a KieSession/KieBase, it fails to compile DRL which imports a class installed in Fuse/Karaf as another bundle.

The bundle with Blueprint container imports the class' package correctly, while the bundle containing the class exports it.

Example use case for this behaviour is when you create a bundle containing domain classes which are used in DRL and by the bundle defining application logic (for inserting facts into the KieSession, for instance).

The same use-case works in OSGi when using kie-spring. My guess would be not passing the correct classloader to the KieContainer created by kie-aries-blueprint.

Please see the reproducer for details.

Version-Release number of selected component (if applicable):
BRMS 6.2.1
Fuse 6.2.1

How reproducible:
always

Steps to Reproduce:
1. see the PR with reproducer - run KieBlueprintDependencyKarafIntegrationTest

Actual results:
The following exception is thrown when creating the KieBase:

Caused by: java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=drl_kiesample_dependency/Hal1.drl, line=10, column=0
   text=Unable to resolve ObjectType 'Assert'], Message [id=2, level=ERROR, path=drl_kiesample_dependency/Hal1.drl, line=7, column=0
   text=Rule Compilation error Only a type can be imported. org.junit.Assert resolves to a package
assertInstance cannot be resolved to a variable], Message [id=3, level=ERROR, path=drl_kiesample_dependency/Hal1.drl, line=1, column=0
   text=Error importing : 'org.junit.Assert']]
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:447)
        at org.kie.aries.blueprint.factorybeans.KieObjectsResolver.resolveKBase(KieObjectsResolver.java:38)
...

Expected results:
The KieBase can be compiled without issues.

Comment 1 Marek Winkler 2016-02-19 10:11:32 UTC
PR with reproducer: https://github.com/droolsjbpm/droolsjbpm-integration/pull/315

Comment 6 Marek Winkler 2016-03-30 12:47:14 UTC
Verified in BRMS 6.3.0 ER2.