Bug 1312164 - drools-workbench-models-guided-dtable missing from drools-karaf-features and not OSGi packaged
Summary: drools-workbench-models-guided-dtable missing from drools-karaf-features and ...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Fuse Integration
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: ---
Assignee: Edson Tirelli
QA Contact: Jiri Petrlik
Klara Bezdekova
URL:
Whiteboard:
Depends On:
Blocks: 1324527
TreeView+ depends on / blocked
 
Reported: 2016-02-25 23:17 UTC by Duane Hawkins
Modified: 2020-03-27 20:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
The drools-karaf-features XML contains a currently nonfunctional drools-workbench-models feature. In OSGi environment, using kJARs containing Guided Decision Tables (created in Business Central) results in the ClassNotFoundException error. There is currently no workaround.
Clone Of:
: 1324527 (view as bug list)
Environment:
Last Closed: 2020-03-27 20:06:31 UTC
Type: Bug


Attachments (Terms of Use)
demo maven project (28.14 KB, application/zip)
2016-02-25 23:17 UTC, Duane Hawkins
no flags Details
Simpliefied reproducer with TCCL workaround applied. (30.93 KB, application/zip)
2016-05-02 13:43 UTC, Petr Široký
no flags Details

Description Duane Hawkins 2016-02-25 23:17:35 UTC
Created attachment 1130685 [details]
demo maven project

Description of problem:

drools-workbench-models are missing from drools-karaf-features, resulting in ClassNotFoundException when using kjar-packaged rules that reference the models.

In the attached example, when the simple ruleset is used, the feature deployes and executes correctly in the Fuse / Karaf environment, but when the ruleset leveraging the decision table is used, the deployment fails with:

Exception in thread "Thread-63" java.lang.IllegalArgumentException: Unable to instantiate service for Class 'org.drools.compiler.compiler.GuidedDecisionTableProvider'
	at org.kie.internal.utils.ServiceRegistryImpl.get(ServiceRegistryImpl.java:169)
	at org.drools.compiler.compiler.GuidedDecisionTableFactory.loadProvider(GuidedDecisionTableFactory.java:42)
	at org.drools.compiler.compiler.GuidedDecisionTableFactory.getGuidedDecisionTableProvider(GuidedDecisionTableFactory.java:35)
	at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.guidedDecisionTableToPackageDescr(KnowledgeBuilderImpl.java:417)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl$14.map(CompositeKnowledgeBuilderImpl.java:446)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildResource(CompositeKnowledgeBuilderImpl.java:319)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:308)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:114)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:105)
	at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:241)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:64)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:230)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieModule(KieBuilderImpl.java:222)
	at org.kie.scanner.KieRepositoryScannerImpl.build(KieRepositoryScannerImpl.java:221)
	at org.kie.scanner.KieRepositoryScannerImpl.buildArtifact(KieRepositoryScannerImpl.java:171)
	at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:127)
	at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:122)
	at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:130)
	at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:116)
	at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:93)
	at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:115)
	at org.drools.example.osgi.ProcessActivator$kieThread.run(ProcessActivator.java:38)
Caused by: java.lang.IllegalArgumentException: Unable to instantiate 'org.drools.workbench.models.guided.dtable.backend.GuidedDecisionTableProviderImpl'
	at org.kie.internal.utils.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:273)
	at org.kie.internal.utils.ServiceRegistryImpl$ReflectionInstantiator.call(ServiceRegistryImpl.java:265)
	at org.kie.internal.utils.ServiceRegistryImpl.get(ServiceRegistryImpl.java:167)
	... 21 more
Caused by: java.lang.ClassNotFoundException: org.drools.workbench.models.guided.dtable.backend.GuidedDecisionTableProviderImpl not found by org.kie.internalapi [279]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:195)
	at org.kie.internal.utils.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:270)
	... 23 more



Version-Release number of selected component (if applicable): 6.3.0-redhat-5


How reproducible:  Consistently


Steps to Reproduce:
1. Deploy JBoss Fuse 6.2.1 with Integration Pack
2. Build the attached project
3. From the Karaf console, execute "features:addurl mvn:com.redhat.example.rules/demo-rules-osgi/1.0-SNAPSHOT/xml/features"
4. From the Karaf console, execute "features:install -c demo-rules-demo"

Actual results:

Exception stack trace similar to above.

Expected results:

Feature loads and outputs to the console

Additional info:

If the loaded module / releaseId arguments on Line 36 of ProcessActivator.java (in the  demo-rules-osgi project) is changed from "demo-project" to "demo-project-simple" (not referencing dtables), the project deploys and outputs as expected.

Wrapping the model jars and enabling dynamic import on the KIE Internal and KIE CI bundles has been tried, as well as shading the model contents into the project bundles, but did not resolve the issue.

Comment 3 Duane Hawkins 2016-03-18 16:06:12 UTC
Is there any status on this one?

Comment 4 Duane Hawkins 2016-03-25 17:59:39 UTC
Hi guys,

Is there any status update for this issue?

Comment 5 Petr Široký 2016-04-04 22:52:20 UTC
I have been looking into this and it will require more changes than expected. Since we would like to support all the WB models (except probably test scenarios), we will need to OSGify few more modules like drools-scorecards, drools-pmml and maybe others. This will require additional work as for example the drools-pmml is not quite ready for OSGi (code wise, not just about missing metadata).

@Duane, what it the expected time frame for the fix? Do we need it for BxMS 6.3.0 GA?

Comment 6 Duane Hawkins 2016-04-05 16:45:08 UTC
@Petr I do have a customer waiting on it.  The only thing is, I haven't found a suitable workaround for it.  What time frames are we looking at?

Comment 7 Duane Hawkins 2016-04-05 16:46:22 UTC
@Petr Let me reach out and see if this is a show-stopper or if there is time before this is needed.

Comment 9 Duane Hawkins 2016-04-06 21:30:08 UTC
@Petr - I asked the customer for clarification, to make sure, but I believe the customer is specifically looking for dtable support, as that is what he specifically mentioned.

Comment 10 Duane Hawkins 2016-04-07 11:33:55 UTC
@Petr - customer confirms.  The other models can be deferred.

Comment 11 Petr Široký 2016-04-11 13:06:58 UTC
It seems we need the blocker flag in order to get this one into 6.3.0.GA. I don't have a permission to do so, could someone else do that?

Comment 14 Jiri Petrlik 2016-04-29 08:15:05 UTC
It is still not possible to use "drools-workbench-models-guided-dtable" in OSGI environment, because class "org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52" is not visible for xstream. The reproducer for this bug was unable to initialize KieContainer and failed with exception:
"com.thoughtworks.xstream.mapper.CannotResolveClassException: org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52".

Comment 16 Petr Široký 2016-05-02 13:42:21 UTC
I have both good and bad news!

First the good:
I found a workaround (at least for the attached reproducer, but should generally work for other use cases as well). The bundle needs to import the guided-dtable packages itself and then the code needs to set the TCCL (ThreadContextClassLoader).

Following package need to be imported:
org.drools.workbench.models.guided.dtable;version="[6.0,7)",                            org.drools.workbench.models.guided.dtable.backend;version="[6.0,7)",                            org.drools.workbench.models.guided.dtable.shared.model;version="[6.0,7)",
org.drools.workbench.models.datamodel.rule;version="[6.0,7)",                            org.drools.workbench.models.guided.dtable.shared.auditlog;version="[6.0,7)",

And then in the Bundle activator class, TCCL needs to be set like this:
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());


The bad news is that this issue does not only affects external kjars, but also local resources (e.g. when the guided-dtable is packaged directly in the bundle).

We still need to properly fix this, but it should not block the release I think (as there is a workaround).

I will also attach improved reproducer with the workaround applied.

Comment 17 Petr Široký 2016-05-02 13:43:50 UTC
Created attachment 1152967 [details]
Simpliefied reproducer with TCCL workaround applied.

Follow the top-level README file to run the reproducer.


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