question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resilience-core OSGi bundle imports javax.annotation.meta

See original GitHub issue

Thanks for raising a Resilience4j issue. Please provide a brief description of your problem along with the versions you are using. If possible, please also consider putting together a complete JUnit test that reproduces the issue.

Resilience4j version: 1.10.0

Java version: 8

Problem description:

In the MANIFEST.MF file you import

Import-Package: javax.annotation,javax.annotation.meta

Not sure what you use the javax.annotation.meta package for, as its not a standard package? Maybe you can remove this

In Apache Camel if we add a osgi feature for this then it fails validating

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.7:verify (validate) on project apache-camel: Verification failures: Verification failures: [ERROR] Feature resolution failed for [camel-resilience4j/3.0.0.SNAPSHOT] [ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=camel-resilience4j; type=karaf.feature; version=3.0.0.SNAPSHOT; filter:=“(&(osgi.identity=camel-resilience4j)(type=karaf.feature)(version>=3.0.0.SNAPSHOT))” [caused by: Unable to resolve camel-resilience4j/3.0.0.SNAPSHOT: missing requirement [camel-resilience4j/3.0.0.SNAPSHOT] osgi.identity; osgi.identity=org.apache.camel.camel-resilience4j; type=osgi.bundle; version=“[3.0.0.SNAPSHOT,3.0.0.SNAPSHOT]”; resolution:=mandatory [caused by: Unable to resolve org.apache.camel.camel-resilience4j/3.0.0.SNAPSHOT: missing requirement [org.apache.camel.camel-resilience4j/3.0.0.SNAPSHOT] osgi.wiring.package; filter:=“(osgi.wiring.package=io.github.resilience4j.bulkhead)” [caused by: Unable to resolve io.github.resilience4j.bulkhead/1.1.0: missing requirement [io.github.resilience4j.bulkhead/1.1.0] osgi.wiring.package; filter:=“(osgi.wiring.package=io.github.resilience4j.core.exception)” [caused by: Unable to resolve io.github.resilience4j.core/1.1.0: missing requirement [io.github.resilience4j.core/1.1.0] osgi.wiring.package; filter:=“(osgi.wiring.package=javax.annotation.meta)”]]]] [ERROR] Repositories: { [ERROR] file:///Users/davsclaus/workspace/camel/platforms/karaf/features/target/classes/features.xml

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
cziegelercommented, Apr 22, 2021

Any feedback on the PR? I think the PR is a correct solution, it has the following changes:

  • change the retention policy to CLASS for the annotations in resilience4j-core/src/main/java/io/github/resilience4j/core/lang - this should do no harm as these annotations are used by IDE and build tools
  • resilience-core : do not export io.github.resilience4j.core.lang - again no harm as these are not needed at runtime
  • resilience-core : avoid importing javax.annotation and javax.annotation.meta - these packages are not available at runtime anyway
  • all other bundles : avoid importing javax.annotation and javax.annotation.meta, and io.github.resilience4j.core.lang - again, these are not used at runtime

The only minor disadvantage is that you can’t use a new core bundle with an older other bundle like cache which imports io.github.resilience4j.core.lang - you need to use the new version of cache as well., But as this hasn’t really worked well with old versions in OSGi anyway, I don’t think it’s a problem.

0reactions
alienintheheightscommented, Apr 22, 2021

Related to this, I was able to get a bundle that includes the resilience4j jar working with other bundles in a Karaf container via the following Felix block in its pom.xml. I’m not an expert on OSGi so perhaps I’ve been a little too wide on the import side. But at least the other bundles are able to consume this without knowledge of these jars now.

    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
           <instructions>
           <Embed-Dependency>
                          *;scope=compile|runtime</Embed-Dependency>
           <Embed-Transitive>true</Embed-Transitive>
           <Export-Package>
                      	   com.mypackage,
                          !io.github.resilience4j.*,
                          !io.vavr.*
            </Export-Package>
            <Import-Package>
                        *;resolution:=optional
           </Import-Package>
         </instructions>
     </configuration>
 </plugin>
Read more comments on GitHub >

github_iconTop Results From Across the Web

resilience-core OSGi bundle imports javax.annotation.meta
Coming soon: A brand new website interface for an even better experience!
Read more >
Bundle Annotations - bnd
A bundle annotation is used to express metadata that cannot otherwise be derived from code. A bundle annotation is applied to a type...
Read more >
3 Module Layer - OSGi Core 7
A bundle can carry descriptive information about itself in the manifest file that is contained in its JAR file under the name of...
Read more >
How to resolve custom bundle A dependency on bundle B
A bundle import, imports a package to use the corresponding programs and resources of ... <Import-Package>javax.annotation;version=0.0.0,*</Export-Package>
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found