This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

JBoss-RESTEasy-Jackson problem  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a web service using resteasy and running in JBoss 6.1. I am attempting to use the JAXB Provider Jettison for the following class:



I am using the @XmlRootElement, @XmlAttribute, @XmlElement annotations.

In my POM file(using Maven to build), I list the dependency for for using resteasy-jaxrs, resteasy-jaxb-provider, and resteasy-jettison-provider.

The xml production works without a problem. However, when the return content type is specifed to be JSON, i get the following exception thrown:

Unexpected error during load of:org.codehaus.jackson.map.JsonMappingException$Reference: java.lang.StackOverflowError
with alot of addtional "at" statements in the print trace stack.

The annotated POJO class has a zero argument constructor and get/set for each element/attribute annotated.

Has anyone else run into this or can offer a suggestion?

Thank you very much.


JD

PS - I have to type everything as the actual development is on another computer behind and I cannot copy/move the code to this unsecure machine.
 
J.D. Thompson
Greenhorn
Posts: 28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, issue resolved. Problem was in the class annotated with @XmlRootElement, @XmlElement, etc. all of the getter and setters were correct for the member variables, however I had named one method "getCopy" to create a deep copy of the POJO. Jackson, upon converting to JSON, evidently was trying to match this to a member variable "copy", couldn't find it and threw an exception.

So, for any helper methods in your RESTEasy POJO's, DO NOT begin with get or set unless they correspond to a member variable.

Hope this posting helps someone else!!!

Happy New Year!!
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!