Bug 1312285

Summary: OSGi: Drools/jBPM engine fails to build a BPMN2 process that uses domain classes
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3.0CC: kverlaen, lpetrovi, rrajasek, rsynek, rzhang
Target Milestone: ER3   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:01:31 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:
Attachments:
Description Flags
Exception stacktrace
none
Exception stacktrace after BZ 1310039 fix none

Description Marek Winkler 2016-02-26 10:35:57 UTC
Created attachment 1130812 [details]
Exception stacktrace

Description of problem:

Drools/jBPM engine fails to create the KieBase for BPMN process which references classes from domain jars installed as another bundle in OSGi container.

The error message "Unable to generate action invoker. org.jbpm.process.instance.impl.Action cannot be resolved to a type" indicates that there might be a missing Import-Package header. Indeed, when I enabled dynamic import (dev:dynamic-import <BUNDLE_ID>) on drools-compiler and drools-core bundles, the process was compiled successfully.

This bug is similar to BZ 1310039, with the following differences:
  - the issue happens not only in Blueprint, but also when you create the KieContainer with proper class loader,
  - there is the workaround (enabling dynamic imports in drools-core and drools-compiler bundles).

The problem will very likely be fixed in Drools, so I reported it here instead of jBPM - feel free to reassign.

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

How reproducible:
always

Steps to Reproduce:
1. see the PR with reproducer - run KieBlueprintProcessDependencyKarafIntegrationTest
2. please be aware that to make the reproducer test pass completely, BZ 1310039 needs to be fixed too.

Actual results:

java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=blueprint_process_dep/sampleProcess.bpmn2, line=-1, column=0
   text=Unable to generate action invoker. org.jbpm.process.instance.impl.Action cannot be resolved to a type], Message [id=2, level=ERROR, path=blueprint_process_dep/sampleRule.drl, line=11, column=0
   text=Unable to resolve ObjectType 'Assert'], Message [id=3, level=ERROR, path=blueprint_process_dep/sampleRule.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=4, level=ERROR, path=blueprint_process_dep/sampleRule.drl, line=1, column=0
   text=Error importing : 'org.junit.Assert']]
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:460)
...


Expected results:
KieBase is built without errors.

Comment 11 Marek Winkler 2016-03-24 13:14:31 UTC
Created attachment 1139956 [details]
Exception stacktrace after BZ 1310039 fix

Added updated stacktrace.

Comment 12 Mario Fusco 2016-03-24 14:47:43 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/cc5a0b4ab

Comment 13 Marek Winkler 2016-04-01 08:31:51 UTC
Ryan, it seems that the commit with the fix has not made it into ER2, could you please double check?

It seems present on 6.4.x branch [1], while it seems not present in sync-6.4.x-2016.03.24 tag.

[1] https://github.com/droolsjbpm/drools/commit/8c0d2dc0ab937fb7e76bfb6411a55d14affd42c8

Comment 14 Marek Winkler 2016-04-14 15:25:19 UTC
The missing commit is present in ER3, waiting for test results for final verification.

Comment 15 Marek Winkler 2016-04-18 13:07:03 UTC
Verified in BRMS 6.3.0 ER3.