Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine OSGi metadata for JSON dependencies #3956

Open
rombert opened this issue Sep 12, 2024 · 2 comments · May be fixed by #3971
Open

Refine OSGi metadata for JSON dependencies #3956

rombert opened this issue Sep 12, 2024 · 2 comments · May be fixed by #3971
Labels
dependencies Pull request that updates a dependency

Comments

@rombert
Copy link

rombert commented Sep 12, 2024

Expected behavior

When deploying in OSGi containers the Jedis bundle has two hard requirements on having the GSON and JSON bundles around. With #3223 and #3249 the dependencies were made optional at runtime (to my understanding).

Additionally, due to an unfortunate interaction between the way the org.json:json bundle does versioning and OSGi metadata requirements OSGi consumers must use the same version as declared in the pom.xml dependencies.

The error messages look something like this.

For missing OSGi bundles

[ERROR] [bundle-packages] redis.clients:jedis:5.1.5: Bundle is importing package org.json with start order 24 but no bundle is exporting these for that start order.
[ERROR] [bundle-packages] redis.clients:jedis:5.1.5: Bundle is importing package com.google.gson;version=[2.10,3) with start order 24 but no bundle is exporting these for that start order in the required version range.

For a version of the org.json:json bundle that is too new

[ERROR] [bundle-packages] redis.clients:jedis:5.1.5: Bundle is importing package org.json;version=[20231013.0,20231014) with start order 24 but no bundle is exporting these for that start order in the required version range.

Actual behavior

The Jedis bundle should resolve in OSGi containers without the JSON and GSON bundlles for deployers who don't use JSON functionality.

The Jedis bundle should resolve in OSGi container with versions of the JSON bundle more recent than the one used in the Jedis pom.xml.

Steps to reproduce:

Please create a reproducible case of your problem. Make sure
that case repeats consistently and it's not random

  1. Deploy the Jedis bundle in an OSGi container without any JSON libraries

Redis / Jedis Configuration

Jedis version:

5.1.5

Redis version:

N/A, did not get so far.

Java version:

openjdk 21.0.4 2024-07-16

@sazzad16
Copy link
Collaborator

Did you try the solutions available online?

If nothing else works, I think you can bundle your own jar including Jedis and only necessary dependencies.

We would also appreciate any idea/PR to solve this from Jedis end (if possible).

@rombert
Copy link
Author

rombert commented Sep 16, 2024

@sazzad16 - yes, I can rewrap the bundle or just ship the dependencies anyway so I'm not completely blocked. I can look into providing a PR for Jedis to adjust the imports:

  • make the json.org imports open-ended so any future versions are accepted
  • make the json.org and GSON imports optional

Probably not this week but hopefully in the near future.

@rombert rombert linked a pull request Sep 27, 2024 that will close this issue
@sazzad16 sazzad16 added the dependencies Pull request that updates a dependency label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull request that updates a dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants