junitapache-felixjbossfuseblueprint-osgipax-exam

Blueprint - Unit testing with Pax Exam - Unable to resolve the dependencies


We are in process of migrating spring based camel application to blue print based camel application. We are also migrating to fuse 6.1 version. I am using Pax Exam with Junit runner along with apache felix container to perform of my unit testing. I am facing problem on unresolved bundle problem related to ehcache manager. I have tried giving required depencies to pax configuration as mavenBundle but without anyluck. Exception doesn't give detail about missing dependencies instead it gives generic error of package only i.e., "osgi.wiring.package=net.sf.ehcache".
I have given necessary depencies in pom.xnl and eclipse doesn't show any error. Below is configuration used in Junit.

'@Configuration public Option[] config() {

    return options(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
            systemProperty("Test.Property").value("system"),
            systemProperty("pax.exam.logging").value("none"),
            systemTimeout(600000),

            mavenBundle("commons-lang", "commons-lang", "2.5"),
            mavenBundle("commons-collections", "commons-collections", "3.2.1"),
            mavenBundle("commons-beanutils", "commons-beanutils", "1.8.3"),
            mavenBundle("commons-io", "commons-io", "2.0"),
            mavenBundle("ch.qos.logback", "logback-core", "1.0.9"),
            mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"),
            mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
            mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.5"),
            mavenBundle("net.sf.ehcache", "ehcache-core", "2.6.9"),
            mavenBundle("net.sf.ehcache", "ehcache", "1.5.0"),
            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint", "1.1.0"),
            mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy", "1.0.0"),
            mavenBundle("org.apache.aries", "org.apache.aries.util", "1.1.0"),
            mavenBundle("channelservicelayer", "base", "1.0.0"),
            mavenBundle("asm", "asm-all", "3.1"),
            junitBundles()
            );
}'

I am attaching logs as below

---
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling SLF4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Jakarta Commons Logging API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Log4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Avalon Logger API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling JULI Logger API support.
16:58:10.097 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.logging.pax-logging-api]
16:58:10.097 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.base]
16:58:10.097 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.swissbox.core]
16:58:10.097 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.swissbox.extender]
16:58:10.100 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.swissbox.framework]
16:58:10.100 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.swissbox.lifecycle]
16:58:10.100 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.swissbox.tracker]
16:58:10.100 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.geronimo.specs.geronimo-atinject_1.0_spec]
16:58:10.101 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.ops4j.pax.tipi.junit]
16:58:10.102 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.commons.lang]
16:58:10.103 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.commons.collections]
16:58:10.105 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.commons.beanutils]
16:58:10.106 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.commons.io]
16:58:10.106 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [ch.qos.logback.core]
16:58:10.106 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [ch.qos.logback.classic]
16:58:10.106 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [slf4j.api]
16:58:10.107 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [jcl.over.slf4j]
16:58:10.116 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Starting blueprint extender...
16:58:10.288 [FelixStartLevel] INFO  o.a.a.b.container.BlueprintExtender - No quiesce support is available, so blueprint components will not participate in quiesce operations
16:58:10.289 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Blueprint extender started
16:58:10.289 [FelixStartLevel] DEBUG o.o.p.s.extender.BundleWatcher - Scanning bundle [org.apache.aries.blueprint]
16:58:10.293 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Found ProxyManager service, starting to process blueprint bundles
16:58:10.295 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.felix.framework for blueprint application
16:58:10.298 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.felix.framework
16:58:10.298 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.exam for blueprint application
16:58:10.299 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.exam
16:58:10.300 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.exam.inject for blueprint application
16:58:10.300 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.exam.inject
16:58:10.300 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.exam.extender.service for blueprint application
16:58:10.300 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.exam.extender.service
16:58:10.300 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle osgi.cmpn for blueprint application
16:58:10.312 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle osgi.cmpn
16:58:10.312 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.logging.pax-logging-api for blueprint application
16:58:10.313 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.logging.pax-logging-api
16:58:10.313 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.base for blueprint application
16:58:10.314 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.base
16:58:10.314 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.swissbox.core for blueprint application
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.swissbox.core
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.swissbox.extender for blueprint application
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.swissbox.extender
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.swissbox.framework for blueprint application
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.swissbox.framework
16:58:10.315 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.swissbox.lifecycle for blueprint application
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.swissbox.lifecycle
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.ops4j.pax.swissbox.tracker for blueprint application
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.ops4j.pax.swissbox.tracker
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.geronimo.specs.geronimo-atinject_1.0_spec for blueprint application
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.geronimo.specs.geronimo-atinject_1.0_spec
16:58:10.316 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.commons.lang for blueprint application
16:58:10.317 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.commons.lang
16:58:10.317 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.commons.collections for blueprint application
16:58:10.326 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.commons.collections
16:58:10.327 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.commons.beanutils for blueprint application
16:58:10.330 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.commons.beanutils
16:58:10.330 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.commons.io for blueprint application
16:58:10.330 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle org.apache.commons.io
16:58:10.330 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle ch.qos.logback.core for blueprint application
16:58:10.331 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle ch.qos.logback.core
16:58:10.331 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle ch.qos.logback.classic for blueprint application
16:58:10.331 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle ch.qos.logback.classic
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle slf4j.api for blueprint application
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle slf4j.api
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle jcl.over.slf4j for blueprint application
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - No blueprint application found in bundle jcl.over.slf4j
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle null
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for null.
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle null
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for null.
16:58:10.332 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scanning bundle org.apache.aries.blueprint for blueprint application
16:58:10.335 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Found blueprint application in bundle org.apache.aries.blueprint with paths: [bundle://23.0:0/OSGI-INF/blueprint/blueprint-cm.xml, bundle://23.0:0/OSGI-INF/blueprint/blueprint-ext.xml]
16:58:10.351 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Scheduling creation of blueprint bundle org.apache.aries.blueprint asynchronously
org.osgi.framework.BundleException: Unresolved constraint in bundle base [26]: Unable to resolve 26.0: missing requirement [26.0] osgi.wiring.package; (osgi.wiring.package=net.sf.ehcache)
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
    at java.lang.Thread.run(Thread.java:745)
16:58:10.355 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle org.apache.aries.util
16:58:10.355 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for org.apache.aries.util.
16:58:10.355 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle base
16:58:10.355 [FelixStartLevel] DEBUG o.a.a.b.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for base.


Solution

  • I have managed to resolve the problem by upgrading the ehcache version to latest of 2.8.5. ehcache-core expects higher version than one I am using as 1.5.2 version of ehcache.
    For osgi beginners like me, the bigger problem is not getting right error message which leaves me to spend lot of time to do investigation.