curator icon indicating copy to clipboard operation
curator copied to clipboard

[CURATOR-432] OSGI bundles should not import org.apache.curator

Open jira-importer opened this issue 8 years ago • 5 comments

Curator bundles will not deploy to an OSGI container like Karaf with an import requirement on a non-existent package. The problem is highlighted in the excerpt from the MANIFEST.MF below

Import-Package: com.google.common.base;version="[20.0,21)",com.google.
 common.collect;version="[20.0,21)",com.google.common.util.concurrent;
 version="[20.0,21)",*org.apache.curator;version="[4.0,5)"*,org.apache.c
 urator.framework;version="[4.0,5)",org.apache.curator.framework.api;v
 ersion="[4.0,5)",org.apache.curator.framework.api.transaction;version
 ="[4.0,5)",org.apache.curator.framework.imps;version="[4.0,5)",org.ap
 ache.curator.framework.listen;version="[4.0,5)",org.apache.curator.fr
 amework.state;version="[4.0,5)",org.apache.curator.retry;version="[4.
 0,5)",org.apache.curator.utils;version="[4.0,5)",org.apache.zookeeper
 ;version="[3.5,4)",org.apache.zookeeper.data;version="[3.5,4)",org.sl
 f4j;version="[1.7,2)"

Originally reported by christopher-johnson, imported from: OSGI bundles should not import org.apache.curator
  • assignee: randgalt
  • status: Open
  • priority: Minor
  • resolution: Unresolved
  • imported: 2025-01-21

jira-importer avatar Sep 14 '17 19:09 jira-importer

randgalt:

We don't have any OSGI expertise. Please provide a PR

jira-importer avatar Sep 24 '17 20:09 jira-importer

githubbot:

Github user acoburn commented on the issue:

https://github.com/apache/curator/pull/237

I actually think the issue here is not with the `org.apache.curator/curator-client` bundle (which is an OSGi bundle), but rather with the underlying zookeeper bundle. The issue there is that ZK uses a dash in its versioning scheme (3.5.x-alpha or 3.5.3-beta) and that version becomes part of the `Bundle-Version` in the manifest file. OSGi versioning can't parse that dash; typically, in such situations the dash is replaced with a period for the `Bundle-Version` field in the manifest.

As an experiment, I re-wrapped the ZK bundle (using the version 3.5.3.beta). Then it became possible to deploy ZK 3.5 in Karaf, and once that was in place, all of the 4.0.0 Curator bundles could be both deployed and started in Karaf.

TL;DR – the Curator bundles are already in fine shape for OSGi, the issue is upstream with Zookeeper, which itself will be resolved as soon as the `-beta` is dropped from the version.

jira-importer avatar Sep 29 '17 12:09 jira-importer

githubbot:

Github user christopher-johnson commented on the issue:

https://github.com/apache/curator/pull/237

the framework imports the root org.curator.* but the client does not. Any import dependency on the framework will fail.

jira-importer avatar Sep 29 '17 13:09 jira-importer

githubbot:

Github user iocanel commented on a diff in the pull request:

https://github.com/apache/curator/pull/237#discussion_r160649759

— Diff: curator-framework/pom.xml —
@@ -100,6 +100,27 @@



+
+org.apache.felix
+maven-bundle-plugin
+3.3.0
+true
+
+
+!org.apache.curator,*
— End diff –

There is no need to define the plugin again. The plugin is defined once in the parent pom and inherited from the rest of the modules.

To customize a modules configuration please set properties:

  • `osgi.import.package`
  • `osgi.export.package`

jira-importer avatar Jan 10 '18 11:01 jira-importer