javarestjerseyjdeveloper

<MessageBodyWriter not found for media type=application/json, using JDeveloper


I'm trying to return a json format data using Jakarta RESTful Web Services While using Jdeveloper however I'm getting the following error with http internal server error 500

this the following RestClass

     import java.util.concurrent.atomic.AtomicLong;
     import javax.ws.rs.Encoded;
     import javax.ws.rs.GET;
     import javax.ws.rs.Path;
     import javax.ws.rs.PathParam;
     import javax.ws.rs.Produces;
     import javax.ws.rs.QueryParam;
     import javax.ws.rs.core.MediaType;

         @Path("hello")
         public class RestClass {
       
              private final AtomicLong count = new AtomicLong();
         
              @GET
              @Path("/print/{name}")
              @Produces(MediaType.APPLICATION_JSON)
              public Hello getHellos(@PathParam("name") String myName ) {
                   Hello hello = new Hello(count.incrementAndGet(), myName);
                   return hello;
    
                }
           }

im using the following jar files

asm-3.1.jar
jersey-core-1.18.jar
jersey-json-1.19.jar
jersey-server-1.18.jar
jersey-servlet-1.18.jar

Solution

  • The issue was fixed after adding an empty constructor to the Hello Class however, it's now returning an empty JSON object