struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: JSON Error - Hibernate Entities
Date Mon, 14 Feb 2011 07:39:37 GMT

Here is the portion from the struts configuration:

  <result name="success" type="json">
    <param name="root">itemsList</param></result>

The ajax action class looks like this:

public class WarrantyAssignmentItemAjaxAction extends BaseAction
  private List<Item> itemsList;
  public List<Item> getItemsList() {
    Return itemsList;

  // other stuff removed from breavity

I always map the root object to the property I want returned for each
AJAX call because I have noticed that JSON complains should it try to
serialize things such as my service objects and so on. 

I did notice that because a few objects within the graph have cyclic
redundancy that JSONWriter logged a few messages about that before it
finally puked so I'm not sure if because my object graph has these
circular references if that is creating problems for it or not.

> -----Original Message-----
> From: Maurizio Cucchiara []
> Sent: Monday, February 14, 2011 1:12 AM
> To: Struts Users Mailing List
> Subject: Re: JSON Error - Hibernate Entities
> Could you post your struts.xml and the action which you're trying to
> serialize?
> I'm pretty sure that your action class contains a reference to a
> connection
> object and the json plugin is trying to serialize it.
> If I'm right you could simply change your root parameter via action
> configuration inside the struts.xml file.
> Maurizio Cucchiara
> Il giorno 14/feb/2011 07.19, "CRANFORD, CHRIS"
> <>
> ha scritto:
> I am trying to return a list of hibernate entities to my AJAX call;
> however, I get the following error message when JSONWriter tries to
> serialize the objects.  Can anyone explain why I am getting this error
> and if there is something I can do to avoid it so I can pass my
> back via a JSON call?
> java.lang.IllegalAccessException: Class
> org.apache.struts2.json.JSONWriter can not access a member of class
> r
> with modifiers "public"
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message