Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Unable to Produce JSON - javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException

 
Ranch Hand
Posts: 229
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am using Jersey 1.15, JDK 1.6, Tomcat 7, Maven 2.2.1 to create a simple Restful Web Service that should return a JSON String from a POJO that I mapped.

Here's my POJO:



my webservice:




Here's my pom.xml:



My web.xml:



After deploying to tomcat, when I try to invoke the web service like this:



I get the following error:



After scouring the Internet, I tried inserting the following proposed solution that everyone suggested into web.xml:



But it still gives me the same issue! It does return the correct data marshalled to XML if I use APPLICATION_XML, however.

Would really appreciate it if someone could point me in the right direction.

Thank you very much for taking the time to read this.
 
James Dekker
Ranch Hand
Posts: 229
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Was able to getting it working by adding this to the pom.xml:



This seems more like a hack (because I have yet to use this library)... It would be interesting if someone would replicate my steps (without this solution) and try to figure out why it fixed Jersey's JSON to object binding...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic