jgoodyear / ApacheKarafCookbook

Samples for Packt Publishing's Apache Karaf Cookbook
Other
67 stars 48 forks source link

Java 8 issue with Pax Exam chapter10-recipe-simple #2

Closed deklanowski closed 9 years ago

deklanowski commented 9 years ago

Hi, Running the chapter10-recipe-simple results in the following test failure when running with Java 1.8 (1.7 is fine). There seems to be a bundle resolution issue that pertains to java.xml.apis missing. Do you know how to solve this ? Thanks in advance, Declan.

`D:\apps\Java\jdk1.8.0_11\bin\java -Dmaven.home=D:\apps\apache-maven-3.0.5 -Dclassworlds.conf=D:\apps\apache-maven-3.0.5\bin\m2.conf -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0\bin" -Dfile.encoding=UTF-8 -classpath "D:\apps\apache-maven-3.0.5\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.0.2 test [INFO] Scanning for projects... [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building chapter10-recipe1-simple 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ chapter10-recipe1-simple --- [INFO] [INFO] --- buildnumber-maven-plugin:1.2:create (default) @ chapter10-recipe1-simple --- [INFO] Checking for local modifications: skipped. [INFO] Updating project files from SCM: skipped. [INFO] Executing: cmd.exe /X /C "git rev-parse --verify HEAD" [INFO] Working directory: D:\ApacheKarafCookbook-master\chapter10\chapter10-recipe1\chapter10-recipe1-simple [INFO] Storing buildNumber: NOREVISION at timestamp: 2015-01-28 10:28:49 [INFO] Executing: cmd.exe /X /C "git rev-parse --verify HEAD" [INFO] Working directory: D:\ApacheKarafCookbook-master\chapter10\chapter10-recipe1\chapter10-recipe1-simple [INFO] Storing buildScmBranch: UNKNOWN_BRANCH [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ chapter10-recipe1-simple --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\ApacheKarafCookbook-master\chapter10\chapter10-recipe1\chapter10-recipe1-simple\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ chapter10-recipe1-simple --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ chapter10-recipe1-simple --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ chapter10-recipe1-simple --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ chapter10-recipe1-simple --- [INFO] Surefire report directory: D:\ApacheKarafCookbook-master\chapter10\chapter10-recipe1\chapter10-recipe1-simple\target\surefire-reports


T E S T S

Running com.packt.TestOsgiServices 22:28:52.314 [main] INFO o.o.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 3.6.0) created. 22:28:52.401 [main] INFO o.o.pax.exam.junit.impl.ProbeRunner - creating PaxExam runner for class com.packt.TestOsgiServices 22:28:52.939 [main] INFO o.o.pax.exam.junit.impl.ProbeRunner - running test class com.packt.TestOsgiServices org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.5.0)) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.inject [2]: Unable to resolve 2.0: missing requirement [2.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.pax.swissbox.tracker)(version>=1.7.0)(!(version>=2.0.0))) [caused by: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.extender.service [3]: Unable to resolve 3.0: missing requirement [3.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)] 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)ERROR: Bundle org.ops4j.pax.exam [1] Error starting link:classpath:META-INF/links/org.ops4j.pax.exam.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.5.0)) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)]) ERROR: Bundle org.ops4j.pax.exam.inject [2] Error starting link:classpath:META-INF/links/org.ops4j.pax.exam.inject.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.inject [2]: Unable to resolve 2.0: missing requirement [2.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.pax.swissbox.tracker)(version>=1.7.0)(!(version>=2.0.0))) [caused by: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]]) ERROR: Bundle org.ops4j.pax.exam.extender.service [3] Error starting link:classpath:META-INF/links/org.ops4j.pax.extender.service.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.extender.service [3]: Unable to resolve 3.0: missing requirement [3.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)])

at java.lang.Thread.run(Thread.java:745)

org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.logging.pax-logging-api [5]: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers) 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.base [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl) 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.core [7]: Unable to resolve 7.0: missing requirement [7.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.extender [8]: Unable to resolve 8.0: missing requirement [8.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.framework [9]: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.pax.swissbox.tracker)(version>=1.7.0)(!(version>=2.0.0))) [caused by: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.tracker [11]: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)] 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) org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.invoker.junit [15]: Unable to resolve 15.0: missing requirement [15.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)] 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) ERROR: Bundle org.ops4j.pax.logging.pax-logging-api [5] Error starting link:classpath:META-INF/links/org.ops4j.pax.logging.api.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.logging.pax-logging-api [5]: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)) ERROR: Bundle org.ops4j.base [6] Error starting link:classpath:META-INF/links/org.ops4j.base.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.base [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)) ERROR: Bundle org.ops4j.pax.swissbox.core [7] Error starting link:classpath:META-INF/links/org.ops4j.pax.swissbox.core.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.core [7]: Unable to resolve 7.0: missing requirement [7.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]) ERROR: Bundle org.ops4j.pax.swissbox.extender [8] Error starting link:classpath:META-INF/links/org.ops4j.pax.swissbox.extender.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.extender [8]: Unable to resolve 8.0: missing requirement [8.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]) ERROR: Bundle org.ops4j.pax.swissbox.framework [9] Error starting link:classpath:META-INF/links/org.ops4j.pax.swissbox.framework.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.framework [9]: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.pax.swissbox.tracker)(version>=1.7.0)(!(version>=2.0.0))) [caused by: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]]) ERROR: Bundle org.ops4j.pax.swissbox.tracker [11] Error starting link:classpath:META-INF/links/org.ops4j.pax.swissbox.tracker.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.swissbox.tracker [11]: Unable to resolve 11.0: missing requirement [11.0] osgi.wiring.package; (&(osgi.wiring.package=org.ops4j.lang)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.net.ssl)]) ERROR: Bundle org.ops4j.pax.exam.invoker.junit [15] Error starting link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.invoker.junit [15]: Unable to resolve 15.0: missing requirement [15.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)]) 22:28:53.952 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.exam [1]] is not resolved 22:28:53.952 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.exam.inject [2]] is not resolved 22:28:53.952 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.exam.extender.service [3]] is not resolved 22:28:53.952 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.logging.pax-logging-api [5]] is not resolved 22:28:53.952 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.base [6]] is not resolved 22:28:53.953 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.swissbox.core [7]] is not resolved 22:28:53.953 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.swissbox.extender [8]] is not resolved 22:28:53.953 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.swissbox.framework [9]] is not resolved 22:28:53.953 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.swissbox.tracker [11]] is not resolved 22:28:53.953 [main] ERROR o.o.p.e.n.i.NativeTestContainer - Bundle [org.ops4j.pax.exam.invoker.junit [15]] is not resolved`

jgoodyear commented 9 years ago

Hi,

Thanks for the report - we'll have a look and see if we can update it to JDK8.

Cheers, Jamie

ANierbeck commented 9 years ago

Ok, got it fixed, unfortunately I wasn't able to create a branch, either my local client is messed up, or I'm not allowed to create a branch in Jamies repo :-)

anyway please find the diff below.

regards, Achim

diff --git a/chapter10/chapter10-recipe1/chapter10-recipe1-simple/pom.xml b/chapter10/chapter10-recipe1/chapter10-recipe1-simple/pom.xml index 8d61ec6..e185f6e 100644 --- a/chapter10/chapter10-recipe1/chapter10-recipe1-simple/pom.xml +++ b/chapter10/chapter10-recipe1/chapter10-recipe1-simple/pom.xml @@ -9,7 +9,7 @@

chapter10-recipe1-simple
    <properties>

@@ -64,12 +64,12 @@

${version.pax-exam}
                    <scope>test</scope>

+

- org.ops4j.pax.exam - pax-exam-testforge - ${version.pax-exam} - test - org.apache.geronimo.specs - geronimo-atinject_1.0_spec - 1.0 - ``` provided
      <dependency>


  @@ -83,7 +83,7 @@
              <dependency>
                      <groupId>org.apache.felix</groupId>
                      <artifactId>org.apache.felix.framework</artifactId>
-                       <version>4.0.3</version>
-                       <version>4.4.1</version>
                      <scope>test</scope>
              </dependency>

2015-01-28 23:02 GMT+01:00 Jamie Goodyear notifications@github.com:

> Hi,
> 
> Thanks for the report - we'll have a look and see if we can update it to
> JDK8.
> 
> Cheers,
> Jamie
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/jgoodyear/ApacheKarafCookbook/issues/2#issuecomment-71925860
> .

## 

Apache Member
Apache Karaf http://karaf.apache.org/ Committer & PMC
OPS4J Pax Web http://wiki.ops4j.org/display/paxweb/Pax+Web/ Committer &
Project Lead
blog http://notizblog.nierbeck.de/
Co-Author of Apache Karaf Cookbook http://bit.ly/1ps9rkS

Software Architect / Project Manager / Scrum Master
ANierbeck commented 9 years ago

hmm looks like a gist would be better: https://gist.github.com/ANierbeck/def24aeb70b8c342d664

ANierbeck commented 9 years ago

fixed in https://github.com/jgoodyear/ApacheKarafCookbook/tree/jdk8

deklanowski commented 9 years ago

Guys, thanks for quick turnaround, I verified that it now works for jdk 7 and 8. Was it simply a case of changing pax exam dependency version and constellation? I have had a hard time in the past lining them up so they work. If you have time to tell me the details I would love to know. Cheers, Declan.

ANierbeck commented 9 years ago

Hi,

yes it's merely the upgrade of Pax Exam 4.4.0 and Felix 4.4.1.

regards, Achim

2015-01-29 14:13 GMT+01:00 Declan Cox notifications@github.com:

Guys, thanks for quick turnaround, I verified that it now works for jdk 7 and 8. Was it simply a case of changing pax exam dependency version and constellation? I have had a hard time in the past lining them up so they work. If you have time to tell me the details I would love to know. Cheers, Declan.

— Reply to this email directly or view it on GitHub https://github.com/jgoodyear/ApacheKarafCookbook/issues/2#issuecomment-72021389 .

Apache Member Apache Karaf http://karaf.apache.org/ Committer & PMC OPS4J Pax Web http://wiki.ops4j.org/display/paxweb/Pax+Web/ Committer & Project Lead blog http://notizblog.nierbeck.de/ Co-Author of Apache Karaf Cookbook http://bit.ly/1ps9rkS

Software Architect / Project Manager / Scrum Master