Hi Erwin,

the problem is that Java 8 does not contain JAXB 2.3.0 (but 2.2.8). So there 
are actually two things to consider:

  1.  Does your application really need JAXB 2.3.0. If it does it might be 
challenging to run that on Java 8 (as you will also need a JAXB implementation 
that implements the newer JAXB version and you might have all kinds of 
interferences between the JAXB version in the JDK and the JAXB version provided 
by you.
  2.  If your application also works with JAXB 2.2.8, you might simply change 
your application’s bundle manifest to wire with JAXB 2.2. You write you compile 
your application with karaf-4.2.4. What does that mean? If you build with Maven 
and added some Karaf artifact as a dependency you might get all kinds of 
transitive dependencies into your stack that are not there when you deploy it 
(the JAXB 2.3.0 API bundle will be part of Karaf, but only if you run on Java 
11 (that does not contain JAXB)). You’d probably better remove that karaf 
artifact dependency and only add the dependencies you really need (and in 
version that you will have in the end).

Best regards
Stephan

From: Erwin Hogeweg <[email protected]>
Sent: Dienstag, 28. Mai 2019 00:49
To: [email protected]
Subject: javax.xml.bind.annotation issue with Karaf-4.2.5 with Java-8

All -

I am pretty sure I have seen a discussion here re. Karaf, 
javax.xml.bind.annotation and Java 8. I can’t find the thread anymore though.

The issue I am running into is this:

                missing requirement 
[com.my.service/1.2.1.SNAPSHOT_20190527-1640] osgi.wiring.package; 
filter:="(&(osgi.wiring.package=javax.xml.bind.annotation)(version>=2.3.0)(!(version>=3.0.0)))”]]

Obviously that is because the jre-1.8 section in jre.properties specifies 2.2.8.

If I change that section to:

                javax.xml.bind;version="2.3.0", \
                javax.xml.bind.annotation;version="2.3.0", \
                javax.xml.bind.annotation.adapters;version="2.3.0", \
                javax.xml.bind.attachment;version="2.3.0", \
                javax.xml.bind.helpers;version="2.3.0", \
                javax.xml.bind.util;version="2.3.0", \

Everything is fine again. I assume I can also find a 2.3.0 api bundle and 
include that in my distro. Haven’t tried that yet.

Couple of questions remain…

1. Where does that 2.3.0 dependency come from when I compile against 
Karaf-4.2.5?
2. Is this the right approach, if not, what is the recommended way?


Thanks as always,

Erwin

Reply via email to