You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Sebastian Heib <he...@synyx.de> on 2014/03/20 09:51:10 UTC

Not able to reinstall custom feature in karaf 3.0.0

Hello,

we have grouped some of our bundles with their dependencies into a
custom feature.

Now if we install this feature in an empty karaf (3.0.0), everything
works as expected.

But in case we want to update that feature (feature:uninstall/
feature:install), this fails with the following error:


Refreshing bundles org.springframework.web.servlet (124), org.springframework.web (123)
Error executing command: Could not start bundle mvn:org.springframework.hateoas/spring-hateoas/0.8.0.RELEASE in feature(s) <customFeature>-1.0.0-SNAPSHOT: Uses constraint violation. Unable to resolve bundle revision org.springframework.hateoas [221.0] because it is exposed to package 'com.fasterxml.jackson.databind' from bundle revisions com.fasterxml.jackson.core.jackson-databind [218.0] and com.fasterxml.jackson.core.jackson-databind [201.0] via two dependency chains.

Chain 1:
  org.springframework.hateoas [221.0]
    import: (&(osgi.wiring.package=com.fasterxml.jackson.databind)(version>=2.2.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=com.fasterxml.jackson.databind
  com.fasterxml.jackson.core.jackson-databind [218.0]

Chain 2:
  org.springframework.hateoas [221.0]
    import: (&(osgi.wiring.package=org.springframework.http.converter.json)(version>=3.2.3)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package=org.springframework.http.converter.json; uses:=com.fasterxml.jackson.databind
  org.springframework.web [123.0]
    import: (&(osgi.wiring.package=com.fasterxml.jackson.databind)(version>=2.0.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=com.fasterxml.jackson.databind
  com.fasterxml.jackson.core.jackson-databind [201.0]


I also tried to install/ reinstall the feature with the -v switch, to
see what bundles are installed. The list is just the same, only that the
messages are different (which are "Found installed bundle" in case the
install command is run in the empty karaf, and "Installing bundle" in
case the feature is reinstalled - for me those LOG messages sound like
they are interchanged).

As I can't see any differences: why is karaf behaving this way? Why does
our feature install in an empty karaf, but we are not able to update it
(even if it is exactly the same feature)?


Here is our feature.xml:

<features name="customFeature-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">

    <feature name="customFeature" version="${project.version}"
resolver="(obr)" description="...">
        <details>...</details>

        <!-- thirdparty features -->
        <feature>war</feature>
        <feature>spring-dm</feature>
        <feature>spring-dm-web</feature>
        <feature version="3.2.4.RELEASE">spring</feature>

        <feature>cxf</feature>

        <!-- thirdparty bundles -->
        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.2.2</bundle>
       
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.2.2</bundle>
       
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.2.2</bundle>

        <bundle>mvn:org.objenesis/objenesis/1.3</bundle>
       
<bundle>mvn:org.springframework.hateoas/spring-hateoas/0.8.0.RELEASE</bundle>

        <bundle>mvn:net.minidev/json-smart/1.2</bundle>
        <bundle>mvn:com.jayway.jsonpath/json-path/0.9.1</bundle>

        <bundle>mvn:com.sun.jersey/jersey-core/1.12</bundle>
        <bundle>mvn:com.sun.jersey/jersey-server/1.12</bundle>
        <bundle>mvn:javax.ws.rs/jsr311-api/1.1.1</bundle>
        <bundle>mvn:com.sun.jersey/jersey-json/1.12</bundle>
        <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.5</bundle>
        <bundle>mvn:org.codehaus.jackson/jackson-jaxrs/1.9.5</bundle>
        <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.5</bundle>

        <!-- app -->
        <bundle>mvn:<anApiBundle>/1.0.0-SNAPSHOT</bundle>
       
<bundle>mvn:<aBundleProvidingAnImplementationForTheApi>/1.0.0-SNAPSHOT</bundle>
        <bundle>mvn:<aRESTBundle>/1.0.0-SNAPSHOT/war</bundle>
    </feature>

</features>

-- 
/**
 * Sebastian Heib
 * Senior Developer
 *
 * synyx GmbH & Co. KG
 * Open Source Solutions
 * Karlstr. 68
 * 76137 Karlsruhe
 *
 * Telefon  +49 721 203823-44
 * Fax      +49 721 203823-12
 * E-Mail   heib@synyx.de
 * Web      http://www.synyx.de
 * Blog     http://blog.synyx.de
 *
 * Sitz der Gesellschaft: Karlsruhe
 * Registergericht: Mannheim
 * Handelsregisternummer: HRA 104793
 * USt-IdNr.: DE249264296
 *
 * Komplementärin: synyx Verwaltung GmbH
 * Sitz der Gesellschaft: Karlsruhe
 * Geschäftsführer:
 * Thomas Kraft, Markus Daniel, Joachim Arrasz
 * Registergericht: Mannheim
 * Handelsregisternummer: HRB 107250
 */


Re: Not able to reinstall custom feature in karaf 3.0.0

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

This is caused by you have multiple version of
com.fasterxml.jackson.core.jackson-databind
in your container, but some bundle's OSGi metadata header isn't so accurate, generally not use correct "use" directive which can cause this  two dependency chains when refresh bundles(features:install can cause it), the most simple solution now is remove one com.fasterxml.jackson.core.jackson-databind bundle
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



On 2014-3-20, at 下午4:51, Sebastian Heib wrote:

> Hello,
> 
> we have grouped some of our bundles with their dependencies into a
> custom feature.
> 
> Now if we install this feature in an empty karaf (3.0.0), everything
> works as expected.
> 
> But in case we want to update that feature (feature:uninstall/
> feature:install), this fails with the following error:
> 
> 
> Refreshing bundles org.springframework.web.servlet (124), org.springframework.web (123)
> Error executing command: Could not start bundle mvn:org.springframework.hateoas/spring-hateoas/0.8.0.RELEASE in feature(s) <customFeature>-1.0.0-SNAPSHOT: Uses constraint violation. Unable to resolve bundle revision org.springframework.hateoas [221.0] because it is exposed to package 'com.fasterxml.jackson.databind' from bundle revisions com.fasterxml.jackson.core.jackson-databind [218.0] and com.fasterxml.jackson.core.jackson-databind [201.0] via two dependency chains.
> 
> Chain 1:
>  org.springframework.hateoas [221.0]
>    import: (&(osgi.wiring.package=com.fasterxml.jackson.databind)(version>=2.2.0)(!(version>=3.0.0)))
>     |
>    export: osgi.wiring.package=com.fasterxml.jackson.databind
>  com.fasterxml.jackson.core.jackson-databind [218.0]
> 
> Chain 2:
>  org.springframework.hateoas [221.0]
>    import: (&(osgi.wiring.package=org.springframework.http.converter.json)(version>=3.2.3)(!(version>=4.0.0)))
>     |
>    export: osgi.wiring.package=org.springframework.http.converter.json; uses:=com.fasterxml.jackson.databind
>  org.springframework.web [123.0]
>    import: (&(osgi.wiring.package=com.fasterxml.jackson.databind)(version>=2.0.0)(!(version>=3.0.0)))
>     |
>    export: osgi.wiring.package=com.fasterxml.jackson.databind
>  com.fasterxml.jackson.core.jackson-databind [201.0]
> 
> 
> I also tried to install/ reinstall the feature with the -v switch, to
> see what bundles are installed. The list is just the same, only that the
> messages are different (which are "Found installed bundle" in case the
> install command is run in the empty karaf, and "Installing bundle" in
> case the feature is reinstalled - for me those LOG messages sound like
> they are interchanged).
> 
> As I can't see any differences: why is karaf behaving this way? Why does
> our feature install in an empty karaf, but we are not able to update it
> (even if it is exactly the same feature)?
> 
> 
> Here is our feature.xml:
> 
> <features name="customFeature-${project.version}"
> xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
> 
>    <feature name="customFeature" version="${project.version}"
> resolver="(obr)" description="...">
>        <details>...</details>
> 
>        <!-- thirdparty features -->
>        <feature>war</feature>
>        <feature>spring-dm</feature>
>        <feature>spring-dm-web</feature>
>        <feature version="3.2.4.RELEASE">spring</feature>
> 
>        <feature>cxf</feature>
> 
>        <!-- thirdparty bundles -->
>        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.2.2</bundle>
> 
> <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.2.2</bundle>
> 
> <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.2.2</bundle>
> 
>        <bundle>mvn:org.objenesis/objenesis/1.3</bundle>
> 
> <bundle>mvn:org.springframework.hateoas/spring-hateoas/0.8.0.RELEASE</bundle>
> 
>        <bundle>mvn:net.minidev/json-smart/1.2</bundle>
>        <bundle>mvn:com.jayway.jsonpath/json-path/0.9.1</bundle>
> 
>        <bundle>mvn:com.sun.jersey/jersey-core/1.12</bundle>
>        <bundle>mvn:com.sun.jersey/jersey-server/1.12</bundle>
>        <bundle>mvn:javax.ws.rs/jsr311-api/1.1.1</bundle>
>        <bundle>mvn:com.sun.jersey/jersey-json/1.12</bundle>
>        <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.5</bundle>
>        <bundle>mvn:org.codehaus.jackson/jackson-jaxrs/1.9.5</bundle>
>        <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.5</bundle>
> 
>        <!-- app -->
>        <bundle>mvn:<anApiBundle>/1.0.0-SNAPSHOT</bundle>
> 
> <bundle>mvn:<aBundleProvidingAnImplementationForTheApi>/1.0.0-SNAPSHOT</bundle>
>        <bundle>mvn:<aRESTBundle>/1.0.0-SNAPSHOT/war</bundle>
>    </feature>
> 
> </features>
> 
> -- 
> /**
> * Sebastian Heib
> * Senior Developer
> *
> * synyx GmbH & Co. KG
> * Open Source Solutions
> * Karlstr. 68
> * 76137 Karlsruhe
> *
> * Telefon  +49 721 203823-44
> * Fax      +49 721 203823-12
> * E-Mail   heib@synyx.de
> * Web      http://www.synyx.de
> * Blog     http://blog.synyx.de
> *
> * Sitz der Gesellschaft: Karlsruhe
> * Registergericht: Mannheim
> * Handelsregisternummer: HRA 104793
> * USt-IdNr.: DE249264296
> *
> * Komplementärin: synyx Verwaltung GmbH
> * Sitz der Gesellschaft: Karlsruhe
> * Geschäftsführer:
> * Thomas Kraft, Markus Daniel, Joachim Arrasz
> * Registergericht: Mannheim
> * Handelsregisternummer: HRB 107250
> */
>