I eventually decided to write a DTO wrapper that took my POJO as a constructor 
argument and extracted the fields I wanted to pass instead of trying to 
serialize the entire object and that seemed to work.  It just appears that the 
amount of information within the POJO was creating issues for JSON to serialize 
it; however I cannot isolate exactly what is the problem in the POJO.  All of 
the properties in the POJO are serializable :=/.

> -----Original Message-----
> From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
> Sent: Monday, February 14, 2011 2:40 AM
> To: Struts Users Mailing List
> Subject: Re: JSON Error - Hibernate Entities
> 
> Your Item class is a simple POJO [1], isn't it?
>  Have you tried to use a DTO [2] object and see what happens?
> 
> [1] http://en.wikipedia.org/wiki/Plain_Old_Java_Object
> [2] http://martinfowler.com/eaaCatalog/dataTransferObject.html
> On 14 February 2011 08:39, CRANFORD, CHRIS <chris.cranf...@setech.com>
> wrote:
> >
> > 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.cucchi...@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.cranf...@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-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> 
> 
> 
> --
> Maurizio Cucchiara
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



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

Reply via email to