You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2023/08/28 16:36:00 UTC
[jira] [Assigned] (CAMEL-19794) OsgiEventAdminNotifier not getting registered
[ https://issues.apache.org/jira/browse/CAMEL-19794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-19794:
-----------------------------------
Assignee: (was: Grzegorz Grzybek)
> OsgiEventAdminNotifier not getting registered
> ---------------------------------------------
>
> Key: CAMEL-19794
> URL: https://issues.apache.org/jira/browse/CAMEL-19794
> Project: Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 3.14.9, 3.21.0
> Reporter: Stephan Siano
> Priority: Minor
>
> After an update from Camel 2.x to Camel 3.14.7 we noticed that the OsgiEventAdminNotifier is not getting registered in Camel 3 blueprint contexts (the same issue exists in all newer Camel 3 versions).
> The reason for this is in the following code in org.apache.camel.blueprint.CamelContextFactoryBean:
> {code}
> try {
> getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
> getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
> } catch (Throwable t) {
> // Ignore, if the EventAdmin package is not available, just don't
> // use it
> LOG.debug("EventAdmin package is not available, just don't use it");
> }
> {code}
> The problem is that the camel-osgi-core bundle (where the class OsgiEventAdminNotifier is located) has an optional import for org.osgi.service.event, but the camel-blueprint bundle where the CamelContextFactoryBean is located does not have this import.
> I see two solutions for the issue:
> either add the line
> org.osgi.service.event;resolution:=optional,
> to camel.osgi.import in the camel-blueprint pom
> or change the above code to use the classloader of the camel-osgi-core bundle to load the EventAdmin class in the code above:
> {code}
> OsgiEventAdminNotifier.class.getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)