Package uses conflict: Import-Package: org.springframework.mail.javamail; version="0.0.0" - osgi

when running my osgi application
i am getting following error:
!ENTRY com.mypackage.commons 4 0 2011-07-06 15:52:21.841
!MESSAGE
!STACK 0
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Package uses conflict: Import-Package: org.springframework.mail.javamail; version="0.0.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1313)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1297)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:319)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330)
please advise.

problem solved by using latest version of org.springframework.context.support dependency.

More information is necessary to diagnose the problem. First I recommend running on Apache Felix rather than Equinox – even if only temporarily – because it has better diagnostics for uses-constraints problems. Also try reading my blog posts: http://njbartlett.name/2011/02/09/uses-constraints.html and http://njbartlett.name/2011/03/31/uses-constraints-in-felix.html

Related

Error installing boot features of karaf in kettle

I am trying to integrate kettle and the big data plugin into my project.
when the karaf of kettle loads the plugin named pdi-osgi-bridge-activator. it throws an exception :
2018-09-01 16:52:09.303 DEBUG 9236 --- [ Thread-52] o.a.k.f.internal.FeaturesServiceImpl : Starting bundle: pdi-osgi-bridge-activator
2018-09-01 16:52:09.365 ERROR 9236 --- [ Thread-52] o.a.k.f.internal.BootFeaturesInstaller : Error installing boot features
java.lang.Exception: Could not start bundle wrap:mvn:pentaho/pdi-osgi-bridge-activator/7.1.0.0-12 in feature(s) pentaho-base-1.0: Unresolved constraint in bundle pdi-osgi-bridge-activator [60]: Unable to resolve 60.0: missing requirement [60.0] osgi.wiring.package; (osgi.wiring.package=org.pentaho.di.core.exception)
at org.apache.karaf.features.internal.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:504) ~[3.0.3:na]
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:459) ~[3.0.3:na]
at org.apache.karaf.features.internal.BootFeaturesInstaller.installBootFeatures(BootFeaturesInstaller.java:92) ~[3.0.3:na]
at org.apache.karaf.features.internal.BootFeaturesInstaller$1.run(BootFeaturesInstaller.java:71) [3.0.3:na]
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle pdi-osgi-bridge-activator [60]: Unable to resolve 60.0: missing requirement [60.0] osgi.wiring.package; (osgi.wiring.package=org.pentaho.di.core.exception)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974) ~[org.apache.felix.main-4.2.1.jar:na]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037) ~[org.apache.felix.main-4.2.1.jar:na]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955) ~[org.apache.felix.main-4.2.1.jar:na]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942) ~[org.apache.felix.main-4.2.1.jar:na]
at org.apache.karaf.features.internal.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:501) ~[3.0.3:na]
... 3 common frames omitted
i know the class:
org.pentaho.osgi.legacy.LegacyPluginExtenderFactory
uses
org.pentaho.di.core.exception.KettlePluginException
but these is nothing happen if i start kettle by Spoon.bat.
do i miss some arguments or configurations?
Which bundle has "org.pentaho.di.core.exception.KettlePluginException"?
It need some bundle to export it.

Karaf - Unable to resolve: missing requirement (osgi.wiring.package; (&(osgi.wiring.package=javax.jms)(version>=2.0.0)(!(version>=3.0.0)))])

I'm trying to install bundle on Karaf but but I keep getting the following error:
Caused by: org.osgi.framework.BundleException: Unable to resolve axsjmsblueprintcaller [56](R 56.0): missing requirement [axsjmsblueprintcaller [56](R 56.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.jms)(version>=2.0.0)(!(version>=3.0.0))) [caused by: Unable to resolve javax.jms-api [58](R 58.0): missing requirement [javax.jms-api [58](R 58.0)] osgi.wiring.package; (osgi.wiring.package=javax.transaction.xa)] Unresolved requirements: [[axsjmsblueprintcaller [56](R 56.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.jms)(version>=2.0.0)(!(version>=3.0.0)))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.karaf.bundle.command.Install.execute(Install.java:96)[24:org.apache.karaf.bundle.core:4.0.4]
... 11 more
After that i'm trying to download javax.jms(javax.jms-api version 2.0.1) and copy it to deploy folder on karaf and run it again but it's still throw that exeption.
Karaf cannot start the bundle. Please help me!

Unable to install KAR containing camel-spring: spring beans missing

I've built an application bundled in an OSGi JAR package and now I'm trying to create a KAR file to easy deployment to Apache Karaf 4.0.8.
When I drop the KAR file there's a warning message complaining that it's impossible to resolve camel-spring due to the missing org.springframework.beans requirement.
2017-01-18 19:07:12,239 | WARN | raf-4.0.8/deploy | KarServiceImpl | 36 -
org.apache.karaf.kar.core - 4.0.8 | Unable to install Kar feature
interfacturas-kar/1.0.0.SNAPSHOT
org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=interfacturas-kar;
type=karaf.feature;
version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]";
filter:="(&(osgi.identity=interfacturas-kar)
(type=karaf.feature(version>=1.0.0.SNAPSHOT)
(version<=1.0.0.SNAPSHOT))"
[caused by: Unable to resolve interfacturas-kar/1.0.0.SNAPSHOT:
missing requirement [interfacturas-kar/1.0.0.SNAPSHOT] osgi.identity;
osgi.identity=org.apache.camel.camel-spring;
type=osgi.bundle;
version="[2.17.0.redhat-630187,2.17.0.redhat-630187]";
resolution:=mandatory
[caused by: Unable to resolve org.apache.camel.camel-spring/2.17.0.redhat-630187:
missing requirement [org.apache.camel.camel-spring/2.17.0.redhat-630187]
osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.springframework.beans)
(version>=3.2.0)(!(version>=4.0.0)))"]]
I cannot figure why this is happening! The kar file does contain spring-beans JAR file of an appropriate version:
$ unzip -l interfacturas-kar-1.0.0-SNAPSHOT.kar
...
614354 2017-01-11 19:07 repository/org/springframework/spring-beans/3.2.16.RELEASE/spring-beans-3.2.16.RELEASE.jar
...
The KAR file and its associated feature XML file is completely generated by karaf-maven-plugin, and it also lists the spring-beans dependency:
<bundle>wrap:mvn:org.springframework/spring-beans/3.2.16.RELEASE</bundle>
along with other spring related resources.
Any has some idea how to fix this? Or why is it happening?
BTW, camel-spring actually comes as a dependency of camel-cxf; I'm using blueprint for defining the routes.

Storm pulling in stale dependencies

We are trying to upgrade from Storm 0.10.0 to 1.0.2 and our project uses kafka-spout
Between versions, backtype.storm package-names were changed to org.apache.storm package-names by the storm-community.
As part of our own upgrade, we had to change storm-kafka's version also to 1.0.2
But when I run the topology on storm, I get the error about missing classes from older version:
apache-storm-1.0.2/bin/storm \
jar \
$jarFile \
org.apache.storm.flux.Flux \
$yamlFile \
--remote
+- Apache Storm -+
+- data FLow User eXperience -+
Version: 1.0.2
Parsing file: topology-config.yaml
333 [main] INFO o.a.s.f.p.FluxParser - loading YAML from input stream...
335 [main] INFO o.a.s.f.p.FluxParser - Not performing property substitution.
335 [main] INFO o.a.s.f.p.FluxParser - Not performing environment variable substitution.
Exception in thread "main" java.lang.NoClassDefFoundError: backtype/storm/spout/MultiScheme
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.storm.flux.FluxBuilder.buildObject(FluxBuilder.java:291)
at org.apache.storm.flux.FluxBuilder.buildComponents(FluxBuilder.java:350)
at org.apache.storm.flux.FluxBuilder.buildTopology(FluxBuilder.java:75)
at org.apache.storm.flux.Flux.runCli(Flux.java:153)
at org.apache.storm.flux.Flux.main(Flux.java:98)
Caused by: java.lang.ClassNotFoundException: backtype.storm.spout.MultiScheme
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
I am not sure from where backtype.storm is creeping into my code-base.
I have looked all over the code-base (and mvn dependency:tree) for 0.10.0 and backtype.storm but those things from older-version are no place to be found.
I even excluded all storm-kafka versions from my child-dependencies and then added an explicit dependency on storm-kafka but it did not change a thing.
Maven does not seem to be at fault because I do not see any 0.10* versions in my ~/.m2/repository:
ls ~/.m2/repository/org/apache/storm/*
~/.m2/repository/org/apache/storm/flux:
1.0.2
~/.m2/repository/org/apache/storm/flux-core:
1.0.2
~/.m2/repository/org/apache/storm/storm:
1.0.2
~/.m2/repository/org/apache/storm/storm-kafka:
1.0.2
Clearly storm is doing something wrong here.
Check your topology-config.yaml, Class is loaded dynamically loaded after picking the class name from the yaml file.
So the issue was because of using shaded jar files as dependencies in our code.
One of the shaded jar file used an older version of the storm-dependency and somehow this was not being shown in the mvn dependency:tree
On excluding the storm dependencies from the shaded jar dependency, the above error went away.
TL;DR: I actual exploded the eventual jar file (using jar -xvf final.jar) and saw duplicate classes in backtype/storm and org/apache/storm packages and the classes in backtype/storm were getting picked up perhaps because backtype comes before org lexicographically? (Not sure on this one because I would have expected the package name to take precedence in such cases).

Karaf Feature install throwing Unsupported 'Bundle-ManifestVersion' value: 1

Hi guys i am getting the below error while using feture install in karaf
org.apache.karaf.features.internal.util.MultiException: Error
at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:358)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:355)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:191)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
Caused by: java.lang.Exception: Unable to create resource for bundle mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT
at org.apache.karaf.features.internal.region.Subsystem.createResource(Subsystem.java:567)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.region.Subsystem$1.downloaded(Subsystem.java:376)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:133)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:127)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListener(DefaultFuture.java:344)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListeners(DefaultFuture.java:329)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.DefaultFuture.setValue(DefaultFuture.java:255)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.AbstractDownloadTask.setFile(AbstractDownloadTask.java:61)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:59)[9:org.apache.karaf.features.core:4.0.3]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_79]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_79]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_79]
... 3 more
Caused by: org.osgi.framework.BundleException: Unable to build resource for mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT: Unsupported 'Bundle-ManifestVersion' value: 1
at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:80)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:69)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.region.Subsystem.createResource(Subsystem.java:565)[9:org.apache.karaf.features.core:4.0.3]
... 15 more
Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1
at org.apache.karaf.features.internal.resolver.ResourceBuilder.doBuild(ResourceBuilder.java:88)[9:org.apache.karaf.features.core:4.0.3]
at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:78)[9:org.apache.karaf.features.core:4.0.3]
... 17 more
feature.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="Diff-Blueprint">
<feature name="Diff-Blueprint" description="Diff-Blueprint" version="0.0.1.SNAPSHOT">
<feature prerequisite="true" dependency="false">wrap</feature>
<bundle>mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT</bundle>
<bundle>wrap:mvn:osgi/osgi/3.0.1</bundle>
<bundle>wrap:mvn:javax.xml/xml/3.1.0</bundle>
<bundle>wrap:mvn:xmlunit/xmlunit/1.6</bundle>
<bundle>wrap:mvn:junit/junit/4.11</bundle>
<bundle>wrap:mvn:org.hamcrest/hamcrest-core/1.3</bundle>
<bundle>mvn:com.googlecode.json-simple/json-simple/1.1.1</bundle>
<bundle>wrap:mvn:de.odysseus.staxon/staxon-jackson/1.2</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.0.6</bundle>
<bundle>wrap:mvn:de.odysseus.staxon/staxon/1.2</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
<bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.13</bundle>
<bundle>wrap:mvn:org.unitils/unitils/2.4</bundle>
<bundle>wrap:mvn:commons-logging/commons-logging/1.1</bundle>
<bundle>wrap:mvn:commons-dbcp/commons-dbcp/1.2.2</bundle>
<bundle>wrap:mvn:commons-pool/commons-pool/1.3</bundle>
<bundle>wrap:mvn:commons-lang/commons-lang/2.3</bundle>
<bundle>wrap:mvn:commons-collections/commons-collections/3.2</bundle>
<bundle>wrap:mvn:ognl/ognl/2.6.9</bundle>
<bundle>wrap:mvn:ant/ant/1.6.5</bundle>
</feature>
</features>
Appreciate that I am resurrecting an old thread here, but to elaborate on #Charity's answer, for anybody who discovers this at a later date (as I did)...
The problem is that we are trying to deploy a non-OSGi compliant bundle, to the container. The solution is to "wrap" the bundle that is causing you problems, by using the Wrap protocol described in the OPS4J Wiki.
JAR Example
A simple example using Maven is shown below:
wrap:mvn:commons-logging/commons-logging/1.1
Note that we have to prefix the bundle with "wrap:", and that is all. See the wiki for more complex examples which override settings defined in the manifest.
WAR Example
Deploy a non-OSGi compliant WAR file in much the same way, using the "webbundle" URI handler instead:
webbundle:mvn:com.example/example-web-app/1.0/war
I have found a solution if we wrap the jars which throw Bundle-ManifestVersion: 1 then this will work
Evidently the Diff-Blueprint bundle has Bundle-ManifestVersion: 1 as a MANIFEST.MF header. This indicates that it predates OSGi Release 4.0, which was released in 2005, so it's unsurprising that a modern version of Karaf does not support it.
So you will have to look into the tool that produced that bundle.
Try to edit MANIFEST.MF file of problematic bundle, just change Bundle-ManifestVersion with value of 2 instead of 1.

Resources