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

Bug 1187219

Summary: OSGi: missing imports for KIE-CI bundle in drools-compiler and kie-internal
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: high    
Version: 6.1.0CC: cmoulliard, kverlaen, mfusco
Target Milestone: ER5   
Target Release: 6.1.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 18:40:07 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:

Description Marek Winkler 2015-01-29 15:01:50 UTC
Description of problem:

It seems that drools-compiler and kie-internal bundles MANIFESTs are missing import for "org.kie.scanner" package. The imports should be declared as optional.

The reasons are:
 - org.drools.compiler.kproject.xml.PomModel attempts to instantiate org.kie.scanner.MavenPomModelGenerator

 - org.drools.compiler.kie.builder.impl.KieRepositoryImpl attempts to obtain KieScannerFactoryService instance through

    KieScannerFactoryService scannerFactoryService = ServiceRegistryImpl.getInstance().get( KieScannerFactoryService.class );

  while kie-internal's ServiceRegistryImpl attempts to instantiate a few classes from package org.kie.scanner.

In general, if bundle A attempts to instantiate a class C by reflection, and that class is located in bundle B, then bundle A should declare import on C's package, and bundle B should export C's package.

I am not an OSGi expert, so setting needinfo on Charles, to review the above statement.

Version-Release number of selected component (if applicable):
BRMS 6.1.0 ER4

How reproducible:
always

Steps to Reproduce:
1. attempt to use KieScanner in OSGi environment (I have no simple reproducer yet, but I have come across this during analysing BZ 1100860)

Actual results:
kie-ci-osgi bundle packages are not accessible by drools-compiler and kie-internal.

Expected results:
kie-ci-osgi bundle packages are accessible by drools-compiler and kie-internal.

Comment 2 Marek Winkler 2015-02-19 10:49:21 UTC
Looking at the drools-compiler and kie-internal MANIFEST files, the Import-Package entry for KIE Scanner looks as follows:

  org.kie.scanner.*;resolution:=optional 

This looks suspicious to me - should not be the "*" character substituted by subpackages as it is for all other packages (such as org.osgi)? Could you please confirm if this is intended?

Thanks!

Comment 3 Mario Fusco 2015-02-19 11:45:28 UTC
The org.kie.scanner package is added with the following declaration to the Import-Package section of the pom.xml file:

=org.kie.scanner.*;resolution:=optional

The '=' symbol before the package name is necessary to enforce the bundle-plugin to include into the manifest file a package for which the module doesn't declare an explicit dependency. However doing so the plugin is no longer able to expand the .* wildcard as it does with other imports. 

I could explicitly add the names of all subpackages of org.kie.scanner into the pom, but this will be error prone because if we will add a further package into kie-ci we could very easily forget of also adding it in the poms of all the modules importing it.

I suggest to check if it works as it is in a OSGi environment and if so leave it unchanged. Conversely if you'll find any problem I'll add the list of the single packages to the pom files of the module importing org.kie.scanner.

Comment 4 Marek Winkler 2015-02-19 12:37:23 UTC
Agreed, I have tested the solution and KIE-CI is indeed available. However, it seems there is another issue related to connecting to remote repositories using http - I have filed BZ 1194257 for that.

The problem reported in this issue has been fixed, marking as verified in BRMS 6.1.0 ER5.