Search code examples
apache-felixapache-karafapache-servicemix

Unable to resolve bundle because of dependency conflict for jackson.annotation in Karaf


Some time while starting a bundle (basecomponent) I am getting the below error. It seems it is because of the two different versions of fasterxml.jackson.annotations . basecomponent bundle is using fasterxml.jackson.annotations 2.7.4 . basecomponent bundle is also using camel-aws which may be using fasterxml.jackson.annotation 2.5.0.

smx@root>bundle:start 277
Error executing command: Error executing command on bundles:
    Unable to execute command on bundle 277: Uses constraint violation. Unable to resolve bundle revision basecomponent [277.0] because it is exposed to package 'com.fasterxml.jackson.annotation' from bundle revisions com.fasterxml.jackson.core.jackson-annotations [284.0] and com.fasterxml.jackson.core.jackson-annotations [125.0] via two dependency chains.

Chain 1:
  basecomponent [277.0]
    import: (&(osgi.wiring.package=com.fasterxml.jackson.annotation)(version>=2.7.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=com.fasterxml.jackson.annotation
  com.fasterxml.jackson.core.jackson-annotations [284.0]

Chain 2:
  basecomponent [277.0]
    import: (osgi.wiring.package=com.amazonaws)
     |
    export: osgi.wiring.package=com.amazonaws; uses:=com.fasterxml.jackson.annotation
  org.apache.servicemix.bundles.aws-java-sdk [254.0]
    import: (&(osgi.wiring.package=com.fasterxml.jackson.annotation)(version>=2.5.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=com.fasterxml.jackson.annotation
  com.fasterxml.jackson.core.jackson-annotations [125.0]

Can some one let me know how can I get around this dependency conflict? I am using Karaf 3.0.5 running under Servicemix 6.1.0.


Solution

  • As suggested in Karaf Mailing List. Moving to Karaf 4.0.5 (under Servicemix 7.0.0.M2 ) and setting dependency=true in feature.xml I am not observing the issue now.