Error returned for interaction between Ajax framework and SSH
 
 
View abnormal display in Firefox
 
Class org. Apache. struts2.json. jsonwriter can not
Access a member of class
Org. Apache. commons. DBCP. poolingdatasource $ poolguardconnectionwrapper
Modifiers "public"
 
 
It is found that this problem occurs when the struts2 pojo action contains object attributes and is managed by hibernate. Hibernate adds the hibernatelazyinitializer attribute to each managed object, and Struts-jsonplugin or other jsonplugin converts pojo to JSON through the Java reflection mechanism, however, hibernatelazyinitializer cannot be obtained by reflection, so an exception is thrown.
 
 
 
This problem also occurs when spring MVC accesses SSH2 through Ajax.
 
 
 
Solution:
 
 
 
Method 1: remove the get method of hibernate Object Management in pojo action, and add <result type = "JSON"> </result> to <Param
Name = "excludeproperties">. * hibernatelazyinitializer </param>:
 
<Result type = "JSON">
 
<Param
Name = "excludeproperties">. * hibernatelazyinitializer </param>
 
</Result>
 
Used when Struts-jsonplugin is used.
 
 
 
Method 2: Add annotation to the pojo class to exclude the attribute hibernatelazyinitializer:
 
Annotation:
 
@ Jsonignoreproperties (value = {"hibernatelazyinitializer "})
 
 
Used to transfer JSON objects using Jackson.