Skip to content
Advertisement

javax.ws.rs.ProcessingException: Error reading entity from input stream while reading List of an Object in Java

I am using Dropwizard. I am trying to use Response to read a class that returns a list of an Object. I have tried using Generic Type and read comments of people who have similar issues but I still have the same error message on hitting the endpoint.

This is the method that calls the api.

JavaScript

This is the error that I have.

JavaScript

I have also tried this

JavaScript

I get the same error message as above.

on logging String.class, I get the desired data that I need.

JavaScript

This prints the list of data to the console. Still wondering what I am doing wrong.

This is the content of inactiveAgentsDTO

JavaScript

I have taken out the imports.

Advertisement

Answer

This is the fix. I created a new class that contains a List of inactive agents. The class is called AllAgentsInfo.

JavaScript

Then I had to rewrite the method to this

JavaScript

This fixed my problem. In case you are wondering what the ResponseDTO.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement