[jboss-jira] [JBoss JIRA] (DROOLS-5345) Class loading issue in Eclipse Equinox OSGi container
Mario Fusco (Jira)
issues at jboss.org
Mon May 25 02:33:06 EDT 2020
[ https://issues.redhat.com/browse/DROOLS-5345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco updated DROOLS-5345:
--------------------------------
Sprint: 2020 Week 22-24 (from May 25) (was: 2020 Week 19-21 (from May 4))
> Class loading issue in Eclipse Equinox OSGi container
> -----------------------------------------------------
>
> Key: DROOLS-5345
> URL: https://issues.redhat.com/browse/DROOLS-5345
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.37.0.Final
> Reporter: Richard Schurig
> Assignee: Mario Fusco
> Priority: Major
>
> When using Drools inside an *Equinox* OSGi container (Oxygen, org.eclipse.osgi-3.12.0.v20170512-1932.jar) the logic inside {{org.drools.relective.classloader.ProjectClassLoader#isOsgiClassLoader}} does not work properly, i.e. the OSGi runtime is not detected. This leads to "The Eclipse JDT Core jar is not in the classpath" because the shaded and packed compiler classes cannot be found.
> Cause of the problem seems to be the fact that the {{EquinoxClassLoader}} does not implement {{BundleReference}} directly *but so does its superclass*. I tried and patched {{ProjectClassLoader}} with the following snippet and this seems to work:
> {code:java}
> private static boolean isOsgiClassLoader(final ClassLoader cl) {
> Class<?> clc = cl.getClass();
> while (clc != null && !clc.equals(ClassLoader.class)) {
> if (Stream.of(clc.getInterfaces()).map(Class::getSimpleName).anyMatch(name -> name.equals("BundleReference"))) {
> return true;
> }
> clc = clc.getSuperclass();
> }
> return false;
> }
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list