fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

Issue when trying to attach a fragment to org.springframework.osgi.extender #2803

Open rdavidson opened 10 years ago

rdavidson commented 10 years ago

First off thanks for all the hard work on fabric8!

We are on an old version of Fabric and are prototyping moving over to Fabric8. I have been trying out the 1.2.0.Beta4 release and I have hit an issue. We use spring-dm in some of our legacy code, and we attach a fragment to org.springframework.osgi.extender in order to customise the spring dm lifecycle.

When we attach the fragment I see the following error:

2014-10-13 10:40:30,988 | ERROR | agent-1-thread-1 | DeploymentAgent | ? ? | 76 - io.fabric8.fabric-agent - 1.2.0.Beta4 | Unable to update agent org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource org.springframework.osgi.extender [org.springframework.osgi.extender/1.2.1] because it exports package 'org.springframework.osgi.extender' and is also exposed to it from resource org.springframework.osgi.extender [org.springframework.osgi.extender/1.2.1] via the following dependency chain:

org.springframework.osgi.extender [org.springframework.osgi.extender/1.2.1] import: (&(osgi.wiring.package=org.springframework.osgi.extensions.annotation)(version>=1.2.1)(version<=1.2.1)) export: osgi.wiring.package=org.springframework.osgi.extensions.annotation; uses:=org.springframework.osgi.extender org.springframework.osgi.extensions.annotations [org.springframework.osgi.extensions.annotations/1.2.1] import: (&(osgi.wiring.package=org.springframework.osgi.extender)(version>=1.2.1)(version<=1.2.1))
export: osgi.wiring.package: org.springframework.osgi.extender

org.springframework.osgi.extender [org.springframework.osgi.extender/1.2.1] at org.apache.felix.resolver.ResolverImpl.checkDynamicPackageSpaceConsistency(ResolverImpl.java:1188)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1086)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.checkDynamicPackageSpaceConsistency(ResolverImpl.java:1402)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1086)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.checkDynamicPackageSpaceConsistency(ResolverImpl.java:1402)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1086)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:260)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at io.fabric8.agent.DeploymentBuilder.resolve(DeploymentBuilder.java:243)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:588)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at io.fabric8.agent.DeploymentAgent$2.run(DeploymentAgent.java:313)[76:io.fabric8.fabric-agent:1.2.0.Beta4] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_25] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_25] at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_25] at java.lang.Thread.run(Thread.java:724)[:1.7.0_25]

When I remove the line 'org.springframework.osgi.extender' from the MANIFEST.MF, the bundle starts ok, so it is something to do with this bundle being a fragment and attaching to the spring-dm bundle. I have created a test project to highlight the issue: https://github.com/rdavidson/Misc/tree/master/extender.test To install the test project in fabric8:

fabric:profile-create test
container-add-profile root test 
fabric:profile-edit --features spring-dm test 
fabric:profile-edit --bundles mvn:com.myproject/extender.test/1.0-SNAPSHOT test

Is this a fabric8 or a Felix / Karaf issue? I don't mind working through this and providing a patch for this issue, but it would be useful for someone to point me in the right direction.

Thanks in advance for your help.

davsclaus commented 9 years ago

We recommend using blueprint instead of spring-dm.