eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
681 stars 339 forks source link

"MessageBodyWriter not found for media type=application/xml" error preventing upgrade from 2.32 to 2.33 #5670

Open jluehe opened 1 month ago

jluehe commented 1 month ago

We are currently running with Jersey 2.32 and trying to upgrade to latest version. However, trying to upgrade to 2.33 already gives an error:

org.glassfish.jersey.message.internal.WriterInterceptorExecutor[] [...] MessageBodyWriter not found for media type=application/xml, type=class test.framework.common.pojos.TestResults, genericType=class test.framework.common.pojos.TestResults.

I have looked at the delta between versions 2.32 and 2.33 (https://github.com/eclipse-ee4j/jersey/compare/2.32...2.33), but don't see anything obvious that could be causing this error.

There are no other changes.

Any ideas?

senivam commented 1 month ago

Do you have

             <groupId>org.glassfish.jersey.media</groupId>
             <artifactId>jersey-media-jaxb</artifactId>

dependency in your classpath? If you use JDK 11+ there should be also

            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>

,

           <groupId>com.sun.xml.bind</groupId>
           <artifactId>jaxb-osgi</artifactId>

dependencies.

jluehe commented 1 month ago

Thank you, @senivam, for your reply!

Yes, I do have the following (we are using JDK 17):

I do not have com.sun.xml.bind:jaxb-osgi though. Is it required? As I said, everything works fine with 2.32, it is only when I upgrade to 2.33 that I get the error ...

senivam commented 1 month ago

I hope, in reality, you have org.glassfish.jersey.media:jersey-media-jaxb:2.33 not 2.32 as is the previous version you are migrating from.

could you please supply the output of the mvn dependency:tree for the module you are having error with?

jluehe commented 1 month ago

I am upgrading all Jersey artifacts at the same time, so yes, as part of the upgrade, I am bumping org.glassfish.jersey.media:jersey-media-jaxb to 2.33 as well.

Will supply the dependency tree shortly ...