Description
Camel 2.17.x upgraded spring version to 4.x in most of the components. but for camel-cxf component, it still has to use spring-dm and spring version 3.x, the spring version range in the Import-Package should keep [3.2,4), not [4.1,5).
Now the ERROR will happen when install camel-cxf feature into karaf container (in case of both Spring 4.x and Spring 3.x are installed in the container)
21:44:41,652 | ERROR | pool-1-thread-1 | al.service.BootFeaturesInstaller 128 | 9 - org.apache.karaf.features.core - 4.0.5 | Error installing boot features org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource org.apache.camel.camel-cxf [org.apache.camel.camel-cxf/2.17.2] because it is exposed to package 'org.springframework.beans' from resources org.apache.servicemix.bundles.spring-beans [org.apache.servicemix.bundles.spring-beans/4.1.7.RELEASE_2] and org.apache.servicemix.bundles.spring-beans [org.apache.servicemix.bundles.spring-beans/3.2.14.RELEASE_1] via two dependency chains. Chain 1: org.apache.camel.camel-cxf [org.apache.camel.camel-cxf/2.17.2] import: (&(osgi.wiring.package=org.springframework.beans)(version>=4.1.0)(!(version>=5.0.0))) export: osgi.wiring.package: org.springframework.beans org.apache.servicemix.bundles.spring-beans [org.apache.servicemix.bundles.spring-beans/4.1.7.RELEASE_2] Chain 2: org.apache.camel.camel-cxf [org.apache.camel.camel-cxf/2.17.2] import: (&(osgi.wiring.package=org.apache.camel.spring)(version>=2.17.0)(!(version>=2.18.0))) export: osgi.wiring.package=org.apache.camel.spring; uses:=org.springframework.beans org.apache.camel.camel-spring [org.apache.camel.camel-spring/2.17.2] import: (&(osgi.wiring.package=org.springframework.beans)(version>=3.2.0)(!(version>=4.0.0))) export: osgi.wiring.package: org.springframework.beans org.apache.servicemix.bundles.spring-beans [org.apache.servicemix.bundles.spring-beans/3.2.14.RELEASE_1] at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[9:org.apache.karaf.features.core:4.0.5] at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:404)[9:org.apache.karaf.features.core:4.0.5] at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158)[9:org.apache.karaf.features.core:4.0.5] at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[9:org.apache.karaf.features.core:4.0.5] at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[9:org.apache.karaf.features.core:4.0.5] at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1152)[9:org.apache.karaf.features.core:4.0.5] at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1048)[9:org.apache.karaf.features.core:4.0.5] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_91] at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]
To fix it, make change to the pom.xml
......
org.springframework*;version="${spring-dm-version-range}";resolution:=optional,
......