• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JSON object containing customer object, throws error.

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Just wondering if someone could help with my JSON issue.
I have a list of objects called Company that contain details such as ID, name, address etc.
I pass these back to a JSP, but I just get the following error.
Now if I replace the jsonData.put("companyList", this.companyList); with someting simple like
jsonData.put("companyList", "A pointless string");, the code works, which would suggest the List and/or Company object is
the problem, but I can't think why. PS, the Company object is Serializable.

Any help greatly appreciated.


struts.xml


Java


JSP


Error:
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error is that you're running out of memory. So the problem isn't necessarily that JSON can't deal with your customer object, it's that there are too many of them.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is odd as the List is only returning 3 Company objects.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as your issue still exists, you may find the 4th step of the following article useful: http://javanus.com/blogs/?tag=org-apache-struts2-json-jsonwriter-add
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!