I searched a looooot and Im not able to find the solution for my problem.
Im using osgi, karaf and java 8.
I have some modules, for example:
WEBSERVICE-SOMETHING inside this module lets say API, PERSISTENCE, ADAPTER
persistence and api starts fine, but adapter gives that error:
Uses constraint violation. Unable to resolve resource adapter [adapter [288](R 288.2)]
because it is exposed to package 'javax.xml.bind.annotation' from resources
org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and
jakarta.xml.bind-api [jakarta.xml.bind-api [79](R 79.0)] via two dependency
chains.
the chains are in the adapter and the api.
but what does that mean?
I can install it as feature and they will all start, but another bundle of mine will be put at GracePeriod and if i do DIAG on karaf it says:
Status: GracePeriod
Declarative Services
Blueprint
01/09/19 19:00
Missing dependencies:
(&(osgi.unit.name=example_db)(objectClass=javax.persistence.EntityManager))
Take note that I have other webservice modules and some of them work fine, I checked the pom's and they have same dependecies and same versions
the datasource is fine as well and I already tried adding some features like hibernate.entityManager and it does not work.
Based on the limited information you provided, most likely you have two versions of the same package exported by different bundles at runtime.
This is not a problem on its own but, as explained in this answer it causes an error when
A
needs packages from B
and packages from C
B
needs different version of the same packages from C
In your particular case the package in question seems to be javax.xml.bind.annotation
which appears to be exported in 2 different versions by
org.apache.felix.framework
bundle and jakarta.xml.bind-api
bundle.
It's hard to say what is the best way way to fix that without knowing what are the exact requirements and capabilities of the bundles you are trying to install.
UPDATE:
Here are some things you can use to debug the situation:
package:exports | grep javax.xml.bind.annotation
will tell you which bundles export the package at what versionspackage:imports | grep javax.xml.bind.annotation
will tell you which bundles imports the package at what versionsbundle:diag <YOUR_BUNDLE_ID>
will give you detailed information why the bundle was not resolvedIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With