0

I am building a simple JAX-RS REST Jersey application that returns a list of messages. (messages is a class that I created.) I made the resource class produce XML response but when I make a call to the resource page I get server errors and the console shows something like this. MessageBodyWriter not found for media type=application/xml Even when restarting the server, it throws an error - JAXB API not found. I tried adding all the dependencies.

I will attach the images of my pom, resource class, model class and service class. Please help me.

Resource class

Model class

Service class

Pom part 1

Pom part 2

Pom dependencies overview

The internal server error when calling the resource

There are many more errors that keep going on in the console like this

Caused by: java.lang.ClassNotFoundException: jakarta.xml.bind.PropertyException at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252) ... 64 more MultiException stack 2 of 2 java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor( implementation=org.glassfish.jersey.jaxb.internal.XmlJaxbElementProvider$App contracts={jakarta.ws.rs.ext.MessageBodyWriter,jakarta.ws.rs.ext.MessageBodyReader}

WARNING: HK2 service reification failed for [org.glassfish.jersey.jaxb.internal.XmlJaxbElementProvider$Text] with an exception: MultiException stack 1 of 2 java.lang.NoClassDefFoundError: jakarta/xml/bind/PropertyException

0 Answers0