Bug 1310714 - [QA](6.2.z)Kie-Aries-Blueprint fails to create a KieBase importing classes from another bundle
[QA](6.2.z)Kie-Aries-Blueprint fails to create a KieBase importing classes fr...
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Fuse Integration (Show other bugs)
6.2.0
Unspecified Unspecified
urgent Severity high
: CR1
: 6.2.3
Assigned To: Mario Fusco
Jiri Petrlik
Petr Penicka
:
Depends On: 1310039
Blocks: 1327763 1327765
  Show dependency treegraph
 
Reported: 2016-02-22 10:06 EST by Alessandro Lazarotti
Modified: 2016-05-12 07:52 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1310039
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alessandro Lazarotti 2016-02-22 10:06:57 EST
+++ This bug was initially created as a clone of Bug #1310039 +++

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.

--- Additional comment from Marek Winkler on 2016-02-19 05:11:32 EST ---

PR with reproducer: https://github.com/droolsjbpm/droolsjbpm-integration/pull/315

--- Additional comment from Marek Winkler on 2016-02-19 05:18:19 EST ---

It would be great if we could get this fixed in 6.2.2 too, but since no customer seems to have hit it yet, it might not be that urgent. Alessandro, what do you think?

I am also not sure how complicated the fix would be.

--- Additional comment from Marek Winkler on 2016-02-19 07:20:05 EST ---

It looks like loading KieModule from a KJar using KIE-CI is also affected. The DRL importing a domain class compile fine, but the rules do not fire when the fact from that domain is inserted into the KieSession.

There is no test for this right now, but you can use this reproducer:

1. git clone git@gitlab.mw.lab.eng.bos.redhat.com:mwinkler/bxms-fuse-integ-labs.git
2. cd bxms-fuse-integ-labs/bxms-core
3. mvn clean install
4. start Fuse 6.2.1
5. follow instructions in bxms-fuse-integ-labs/bxms-core/lab4-kie-aries-blueprint/instructions.txt

This will install a bundle which attempts to load a KJar with rules using domain classes. Then see data/log/fuse.log saying that the KieModule was succesfully loaded, but that the Order has not been evaluated for approval (the rules did not match):

13:13:46,990 | WARN  | l Console Thread | ApproveDrinkOrderBean            | 313 - com.redhat.courses.bxmsfuse.lab4.kie-aries-blueprint-example - 1.0.0.SNAPSHOT | Order Order{customer=Customer{name='Old one', ag
eInYears=34}, drink=Drink{name='Scotch Whisky', containsAlcohol=true}, approved=null} has not been evaluated for approval!

The same use-case again works with kie-spring in Fuse.

It is also possible I am doing something wrong, please let me know if that is the case. Thanks!

--- Additional comment from Alessandro Lazarotti on 2016-02-22 10:06:21 EST ---

i am including it to 6.2.2
Comment 2 Mario Fusco 2016-04-18 03:43:23 EDT
Cherry-picked to 6.3.x branch with https://github.com/droolsjbpm/droolsjbpm-integration/commit/3e0a38c6b3867d78a13c49cdce8269d872b88f05
Comment 3 Jiri Petrlik 2016-05-09 12:00:06 EDT
Verified using BxMS 6.2.3.CR1 and blueprint demo from bxms-fuse-integ-labs [1]. The demo was slightly modified to reproduce the issue. It was necessary to uncomment beans on lines 8 and 18 in "src/main/filtered-resources/OSGI-INF/blueprint/blueprint.xml" and uncomment kie-module on line 14 in "src/main/filtered-resources/OSGI-INF/blueprint/kie.xml".

[1] https://gitlab.mw.lab.eng.bos.redhat.com/mwinkler/bxms-fuse-integ-labs/tree/master/bxms-core/lab4-kie-aries-blueprint
Comment 4 Petr Široký 2016-05-12 07:52:50 EDT
One more commit needed relate to this issue. It was forgotten before: https://github.com/droolsjbpm/droolsjbpm-integration/commit/7e4929237af92c7dc9044e0ea37940cb36546d07

Note You need to log in before you can comment on or make changes to this bug.