0

I'm using JAX-RS to provide rest API in my Java application and I'm having problem with deserializing objects that contain other objects. For such objects (beans), upon deserializing, I get the error "A message body reader for Java class ClassName, and Java type class ClassNAme2, and MIME media type application/json was not found". I googled the error and figured out that there should be something wrong regarding "MessageBodyReader"; however, I'm not quite sure what is going on and how I should use this interface to address the problem. Any help is much appreciated.

user1558274
  • 39
  • 1
  • 1
  • 3

2 Answers2

0

At a minimum try adding JAXB's @XmlRootElement annotation to your classes that are involved in serialization. See if that eliminates the error and then add more JAXB annotations as necessary...

condit
  • 10,852
  • 2
  • 41
  • 60
0

@user1558274, Make sure you are not missing jersey-json-1.8.jar or jersey-server jar. And you need to annotate your POJO's with @XmlRootElement. Click following links to get know more.

Community
  • 1
  • 1
Jeevan Patil
  • 6,029
  • 3
  • 33
  • 50