You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Erwin Hogeweg <er...@me.com> on 2019/05/27 22:48:42 UTC

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

Re: javax.xml.bind.annotation issue with Karaf-4.2.5 with Java-8

Posted by Freeman Fang <fr...@gmail.com>.
Hi Erwin,

Actually you can always specify jaxb version like
javax.xml.bind*;version=“[2,3)”,
in your bundle pom.xml maven-bundle-plugin configuration, to make it work both with jaxb2.2 and 2.3

Cheers

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





> On May 29, 2019, at 9:42 PM, Erwin Hogeweg <er...@me.com> wrote:
> 
> Hi Stephan, Christian -
> 
> Thanks for your replies.
> 
> My issue was that the same set of bundles compile and run just fine with Karaf 4.2.0, but when I compile with ref. to Karaf-4.2.5 I get this jaxb 2.3.0 dependency error. 
> 
> It appears that the jaxb 2.3.0 dependency is pulled in during compilation from the org.apache.karaf.jaas.modules bundle as jakarta.xml.bind-api. The 4.2.0 version of the jaas module did not have that dependency.
> 
> When I compile the bundles with ref to karaf-4.2.0 and only specify 4.2.5 in feature and distro all is well. So that problem appears to be solved.
> 
> Erwin
> 
> 
>> On May 28, 2019, at 03:18, Siano, Stephan <stephan.siano@sap.com <ma...@sap.com>> wrote:
>> 
>> 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:
>> 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.
>> 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 <erwin.hogeweg@me.com <ma...@me.com>> 
>> Sent: Dienstag, 28. Mai 2019 00:49
>> To: user@karaf.apache.org <ma...@karaf.apache.org>
>> 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
> 


Re: javax.xml.bind.annotation issue with Karaf-4.2.5 with Java-8

Posted by Erwin Hogeweg <er...@me.com>.
Hi Stephan, Christian -

Thanks for your replies.

My issue was that the same set of bundles compile and run just fine with Karaf 4.2.0, but when I compile with ref. to Karaf-4.2.5 I get this jaxb 2.3.0 dependency error. 

It appears that the jaxb 2.3.0 dependency is pulled in during compilation from the org.apache.karaf.jaas.modules bundle as jakarta.xml.bind-api. The 4.2.0 version of the jaas module did not have that dependency.

When I compile the bundles with ref to karaf-4.2.0 and only specify 4.2.5 in feature and distro all is well. So that problem appears to be solved.

Erwin


> On May 28, 2019, at 03:18, Siano, Stephan <st...@sap.com> wrote:
> 
> 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:
> 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.
> 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 <er...@me.com> 
> Sent: Dienstag, 28. Mai 2019 00:49
> To: user@karaf.apache.org
> 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


RE: javax.xml.bind.annotation issue with Karaf-4.2.5 with Java-8

Posted by "Siano, Stephan" <st...@sap.com>.
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 <er...@me.com>
Sent: Dienstag, 28. Mai 2019 00:49
To: user@karaf.apache.org
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

Re: javax.xml.bind.annotation issue with Karaf-4.2.5 with Java-8

Posted by Christian Lutz <Ch...@kreeloo.de>.
Hello Erwin,

in my case it was because I used CXF 3.3.2 with OpenApi. 

In your case another dependency may be the reason. 

kind regards
Christian

> Am 28.05.2019 um 00:48 schrieb Erwin Hogeweg <er...@me.com>:
> 
> 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