struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CRANFORD, CHRIS" <Chris.Cranf...@setech.com>
Subject RE: JSON Error - Hibernate Entities
Date Mon, 14 Feb 2011 07:39:37 GMT

Here is the portion from the struts configuration:
struts-warranty.xml

<action 
  name="ajaxWarrantyItemsAcList"
  class="com.setech.dw.warranty.web.WarrantyAssignmentItemAjaxAction">
  <result name="success" type="json">
    <param name="root">itemsList</param></result>
  </result>
</action>

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 [mailto:maurizio.cucchiara@gmail.com]
> 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"
> <Chris.Cranford@setech.com>
> 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
objects
> back via a JSON call?
> 
> java.lang.IllegalAccessException: Class
> org.apache.struts2.json.JSONWriter can not access a member of class
>
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
> r
> with modifiers "public"
> 
> Chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message