[ https://issues.apache.org/jira/browse/KARAF-4411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15402061#comment-15402061 ]
Guillaume Nodet commented on KARAF-4411: ---------------------------------------- Unfortunately, the resolver can not guarantee that it will return the "best" solution. So a small change in the input can result in somewhat different solution. {code} karaf@root()> requirement-add --simulate --verbose "spring/4.2" Changes to perform: Region: root Bundles to install: mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/4.2.5.RELEASE_1 mvn:org.springframework/spring-aop/3.1.4.RELEASE mvn:org.springframework/spring-asm/3.1.4.RELEASE mvn:org.springframework/spring-beans/3.1.4.RELEASE mvn:org.springframework/spring-context/3.1.4.RELEASE mvn:org.springframework/spring-context-support/3.1.4.RELEASE mvn:org.springframework/spring-core/3.1.4.RELEASE mvn:org.springframework/spring-expression/3.1.4.RELEASE Bundles to refresh: org.apache.activemq.activemq-osgi/5.13.2 (Should be wired to: org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.context)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional), org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.beans)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional), org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.core.io)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional)) org.apache.xbean.spring/3.18.0 (Should be wired to: org.springframework.core/3.1.4.RELEASE (through [org.apache.xbean.spring/3.18.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.core.io)(version>=2.5.0)(!(version>=4.0.0)))"), org.springframework.beans/3.1.4.RELEASE (through [org.apache.xbean.spring/3.18.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.beans)(version>=2.5.0)(!(version>=4.0.0)))"), org.springframework.context/3.1.4.RELEASE (through [org.apache.xbean.spring/3.18.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.context)(version>=2.5.0)(!(version>=4.0.0)))")) karaf@root()> requirement-add --simulate --verbose "spring/4" Changes to perform: Region: root Bundles to install: mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/4.2.5.RELEASE_1 karaf@root()> {code} This use case can be simplified a bit by blacklisting the spring 3.1 features by adding the following line into {{etc/blacklisted.properties}}: {code} spring;range="[3.0,3.2)" {code} But we still have a slightly unexpected output: {code} karaf@root()> requirement-add --simulate --verbose "spring/4.2" Changes to perform: Region: root Bundles to install: mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/4.2.5.RELEASE_1 Bundles to refresh: org.apache.activemq.activemq-osgi/5.13.2 (Should be wired to: org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.core.io)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional), org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.context)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional), org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 (through [org.apache.activemq.activemq-osgi/5.13.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.springframework.beans)(version>=3.0.0)(!(version>=5.0.0)))"; resolution:=optional)) karaf@root()> requirement-add --simulate --verbose "spring/4" Changes to perform: Region: root Bundles to install: mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/4.2.5.RELEASE_1 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/4.2.5.RELEASE_1 karaf@root()> {code} In the above scenario, the difference is that activemq is wired to either spring 3.2 or spring 4.2. I also just spotted a possible source of this problem with activemq. I see the following import: {code} org.springframework.osgi.context.support;resolution:=optional;version="[3,5)", {code} which is wrong, because this package comes from spring-dm, so exported in version 1.2.1, not 3.x or 4.x. This means that this import will never be satisfied. > FeatureResolver: spring-dm-web feature installs Spring ver 3.1.4 and 3.2.14 > at the same time > -------------------------------------------------------------------------------------------- > > Key: KARAF-4411 > URL: https://issues.apache.org/jira/browse/KARAF-4411 > Project: Karaf > Issue Type: Bug > Components: karaf-feature > Affects Versions: 4.0.4 > Environment: Oracle JDK 1.8 > Reporter: Vladimir Konkov > Assignee: Guillaume Nodet > Fix For: 4.1.0, 4.0.6 > > > Similar to KARAF-4159. > To reproduce: > $ feature:install spring-dm-web > $ la > ... > 56 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-aop > 57 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-beans > 58 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-context > 59 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-context-support > 60 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-core > 61 | Active | 30 | 3.2.14.RELEASE_1 | Apache ServiceMix :: Bundles :: > spring-expression > ... > 106 | Active | 30 | 3.1.4.RELEASE | Spring AOP > 107 | Active | 30 | 3.1.4.RELEASE | Spring ASM > 108 | Active | 30 | 3.1.4.RELEASE | Spring Beans > 109 | Active | 30 | 3.1.4.RELEASE | Spring Context > 110 | Active | 30 | 3.1.4.RELEASE | Spring Context Support > 111 | Active | 30 | 3.1.4.RELEASE | Spring Core > 112 | Active | 30 | 3.1.4.RELEASE | Spring Expression Language > 113 | Active | 30 | 1.2.1 | spring-osgi-web -- This message was sent by Atlassian JIRA (v6.3.4#6332)