Karaf unresolved constraint in bundle : !(version>=1.0.0) - java

I just added a new dependencie in my tata-core-provider-servlets pom.xml : "io.jsonwebtoken" in version "0.7.0". I can build my project in Eclipse but when I want to start the bundle in Karaf I have this error:
Error executing command: Error executing command on bundles:
Unable to execute command on bundle 758: Unresolved constraint in bundle tata-core-provider-servlets [758]: Unable to resolve 758.0: missing requirement [758.0] osgi.wiring.package; (&(osgi.wiring.package=io.jsonwebtoken)(version>=0.7.0)(!(version>=1.0.0)))
Is there a restriction in Karaf ? Like no dependencies under 1.0.0 ?
Thanks

Some other library in your bundle require version > 1, I guess.

Related

"org.osgi.framework.BundleException: Unable to resolve" with Maven's dependency

I am new to AEM/Maven, and was following this simple tutorial to add the json-simple dependency.
Here is what I added to my pom.xml, and clicked on sync on top right to download that package.
you can see the full pom.xml here.
But when I install with mvn clean install -PautoInstallBundle, the build is success, but in my logs I get the following error message:
27.07.2022 20:00:15.531 *ERROR* [Background Update rampup.core (619)] org.apache.felix.http.jetty Cannot install or update bundle from /var/folders/hh/yvvgql191_l3vb9km9bxgpm80000gp/T/install2076326317699076133.tmp (org.osgi.framework.BundleException: Unable to resolve rampup.core [619](R 619.34): missing requirement [rampup.core [619](R 619.34)] osgi.wiring.package; (&(osgi.wiring.package=org.json.simple)(version>=1.1.0)(!(version>=2.0.0))) Unresolved requirements: [[rampup.core [619](R 619.34)] osgi.wiring.package; (&(osgi.wiring.package=org.json.simple)(version>=1.1.0)(!(version>=2.0.0)))])
org.osgi.framework.BundleException: Unable to resolve rampup.core [619](R 619.34): missing requirement [rampup.core [619](R 619.34)] osgi.wiring.package; (&(osgi.wiring.package=org.json.simple)(version>=1.1.0)(!(version>=2.0.0))) Unresolved requirements: [[rampup.core [619](R 619.34)] osgi.wiring.package; (&(osgi.wiring.package=org.json.simple)(version>=1.1.0)(!(version>=2.0.0)))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4368)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2281)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.run(BaseUpdateInstallHelper.java:198) [org.apache.felix.webconsole:4.6.2]
at java.base/java.lang.Thread.run(Thread.java:834)
I have looked here and here. They talk about installing an export bundle, or to install the missing org.json.simple, but their solution are too high level for me.
Thanks for any clarification to fix this.

how to fix org.osgi.framework.BundleException

I'm running ONOS and when I want to add my module to its core I get this exception.
that was OK before but when I changed my OS, I get this error.
I've tried lots of ways but none of them fits my problem.
I also have no POM file to add dependency.
any other suggestions would be appreciated
ERROR: Bundle sdn.FANA.optical.optical [178] Error starting mvn:sdn.FANA.optical/optical/1.0 (org.osgi.framework.BundleException: Unresolved constraint in bundle sdn.FANA.optical.optical [178]: Unable to resolve 178.0: missing requirement [178.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.karaf.shell.api.action)(version>=4.2.0)(!(version>=5.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle sdn.FANA.optical.optical [178]: Unable to resolve 178.0: missing requirement [178.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.karaf.shell.api.action)(version>=4.2.0)(!(version>=5.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
at java.lang.Thread.run(Thread.java:748)
This error message says that your bundle depends on the package org.apache.karaf.shell.api.action, version range [4.2.0, 5.0.0).
Whenever a bundle has an import, it must be matched by a corresponding export from another bundle. So you need to install the bundle that exports the package org.apache.karaf.shell.api.action, with version at least 4.2.0 and less than 5.0.0.

how to fix missing requirement while the deployment of an OSGI bundle

I am trying to deploy a simple OSGI bundle (hello world) in glassfish 4.1.1 but I got the following error:
Infos: org.osgi.framework.BundleException:
Unresolved constraint in bundle com.mycompany.MavenHelloServiceImpl [324]:
Unable to resolve 324.0: missing requirement [324.0]
osgi.wiring.package; (osgi.wiring.package=com.mycompany.mavenhelloserviceapi)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
I don't know how to fix the missing package , I already defined "com.mycompany.mavenhelloserviceapi" as a dependency in the bundle MavenHelloServiceImpl and it is present in the dependencies folder in the bundle MavenHelloServiceImpl
Any idea how to fix this error ?!
Having com.mycompany.mavenhelloserviceapi as a dependency in your pom.xml is not enough : the pom is about compile-time dependencies. you see here an issue about a runtime dependency missing.
You should install com.mycompany.mavenhelloserviceapi in your container.
You should modify the project that contains com.mycompany.mavenhelloserviceapi as a bundle project and explicitly export this package. now deploy this bundle alongwith your hello world bundle.
Alternatively ,you can use Pax Wrap to deploy the jar that contains com.mycompany.mavenhelloserviceapi to glassfish without modifying the project.

Installing hibernate bundle in AEM OSGI

I got hibernate jar as osgi bundle from -http://mvnrepository.com/artifact/org.hibernate/hibernate-osgi.
When I installed it in fresh AEM 6.1 , I got the following error -
Unresolved constraint in bundle org.hibernate.osgi [448]: Unable to resolve 448.0: missing requirement [448.0] osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=2.1.0)))
org.osgi.framework.BundleException: Unresolved constraint in bundle org.hibernate.osgi [448]: Unable to resolve 448.0: missing requirement [448.0] osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=2.1.0))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4095)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2114)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)
at org.apache.felix.webconsole.internal.core.InstallHelper.doRun(InstallHelper.java:67)
at org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.doRun(BaseUpdateInstallHelper.java:93)
at org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.run(BaseUpdateInstallHelper.java:123)
at java.lang.Thread.run(Unknown Source)
04.01.2016 21:43:00.498 *ERROR* [FelixDispatchQueue] org.hibernate.osgi FrameworkEvent ERROR (org.osgi.framework.BundleException: Unresolved constraint in bundle org.hibernate.osgi [448]: Unable to resolve 448.0: missing requirement [448.0] osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=2.1.0))).
Can anyone help ?
The problem is that the persistent API 2.1 is missing. Which means there have to be another bundle which exports the javax.persistence package with version 2.1.

Unresolved constraint in bundle with Java 8 and Felix

I have an app running under Tomcat 6. The app contains/uses shared library, say Shared.jar. At some point it would copy Shared.jar with unique name, load it as an OSGi bundle into a Felix instance, and start it. In Shared.jar MANIFEST.MF there's
Import-Package: org.osgi.framework,javax.swing,javax.net,javax.net.ssl.
It's all fine with Java < 8, but with Java 8 the app itself starts fine, but starting a bundle fails with exception
Unresolved constraint in bundle [21431]: Unable to resolve 21431.0: missing requirement [21431.0] osgi.wiring.package; (osgi.wiring.package=javax.net)
What's wrong?
You need minimum Karaf 2.4 to support Java 8.
May be you would also need to add import package declaration in your pom.xml
<Import-Package>javax.net.*</Import-Package>
..but that doesn't look like the main issue, because it is working with older versions of JRE.

Categories

Resources