The following is the relevant information :
struts.xml:
......
.......
Action:
public class ProjectVersionAction extends BaseAction {
private static final long serialVersionUID =-3683721108697436670L;
private ProjectVersionService projectVersionService;
private List
private long projectId;
public String findVersionByProject () {
projectVersions = projectVersionService.findByProject (projectId);
return "json";
}
/ * to provide all of the getter / setter * /
}
ProjectVersion categories:
public class ProjectVersion implements Serializable {
private static final long serialVersionUID = 6222511923126470050L;
private Project project;
private long versionId;
private String version;
/ * to provide a getter / setter * /
}
Project category :
public class Project implements Serializable {
private static final long serialVersionUID = 947162450880795125L;
private long projectId;
private String projectName;
private String projectDesc;
private String activeFg;
/ * to provide a getter / setter * /
}
Problem Description :
page via JQuery ajax calls findVersionByProject methods console given as follows:
10:32:58,780 DEBUG JSONWriter: 72 - com.hp.cmu.dbmanager.model.ProjectVersion.getCallbacks ()
java.lang.NoSuchMethodException: com.hp.cmu.dbmanager.model.ProjectVersion.getCallbacks ()
at java.lang.Class.getMethod (Class.java: 1605)
at org.apache.struts2.json.JSONWriter.findBaseAccessor (JSONWriter.java: 266)
at org.apache.struts2.json.JSONWriter.bean (JSONWriter.java: 194)
at org.apache.struts2.json.JSONWriter.processCustom (JSONWriter.java: 171)
at org.apache.struts2.json.JSONWriter.process (JSONWriter.java: 161)
at org.apache.struts2.json.JSONWriter.value (JSONWriter.java: 127)
at org.apache.struts2.json.JSONWriter.array (JSONWriter.java: 455)
at org.apache.struts2.json.JSONWriter.process (JSONWriter.java: 151)
at org.apache.struts2.json.JSONWriter.value (JSONWriter.java: 127)
at org.apache.struts2.json.JSONWriter.add (JSONWriter.java: 363)
at org.apache.struts2.json.JSONWriter.bean (JSONWriter.java: 223)
at org.apache.struts2.json.JSONWriter.processCustom (JSONWriter.java: 171)
at org.apache.struts2.json.JSONWriter.process (JSONWriter.java: 161)
at org.apache.struts2.json.JSONWriter.value (JSONWriter.java: 127)
at org.apache.struts2.json.JSONWriter.write (JSONWriter.java: 95)
at org.apache.struts2.json.JSONUtil.serialize (JSONUtil.java: 116)
at org.apache.struts2.json.JSONResult.createJSONString (JSONResult.java: 196)
at org.apache.struts2.json.JSONResult.execute (JSONResult.java: 170)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult (DefaultActionInvocation.java: 374)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 278)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (DebuggingInterceptor.java: 256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java: 176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (ValidationInterceptor.java: 265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java: 68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept (ConversionErrorInterceptor.java: 138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 211)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 211)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept (StaticParametersInterceptor.java: 190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept (MultiselectInterceptor.java: 75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept (CheckboxInterceptor.java: 90)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept (FileUploadInterceptor.java: 243)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept (ModelDrivenInterceptor.java: 100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept (ScopedModelDrivenInterceptor.java: 141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept (ChainingInterceptor.java: 145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (PrepareInterceptor.java: 171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18nInterceptor.java: 176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (ServletConfigInterceptor.java: 164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (AliasInterceptor.java: 192)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept (ExceptionMappingInterceptor.java: 187)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 249)
at org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java: 54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java: 511)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java: 432)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent (SiteMeshFilter.java: 129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter (SiteMeshFilter.java: 77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter (ActionContextCleanUp.java: 102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java: 88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java: 76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 293)
at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java: 859)
at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process (Http11Protocol.java: 602)
at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java: 489)
at java.lang.Thread.run (Thread.java: 662)
The investigation is due to a delay in the conversion json-plugin cause problems when loading the object , when the object is removed from the project in projectVersion function properly. So the question now is to add "excludeProperties" or "includeProperties" attribute in struts.xml Lane to filter invalid object or attribute some of the generated proxy class , but I do not know specifically how to configure ? Hibernate done similar projects in the past , adding that such problems can be solved as follows :
. * hibernateLazyInitializer
replaced MyBatis do not know, there is hope in this area has experienced friends tell me , thank you !
------ Solution ---------------------------------------- ----
related objects inside an object is likely to cause such a situation , the best thing to use a simple string like, what to take anything. Do not create a relationship .
------ Solution ---------------------------------------- ----
know how to return the json object .
is so configured it?
projectVersions
generally given a class of specialized storage json data .
such as: 2 property
String msg ;/ / prompt information
Object o ;/ / return data is list / single object can be.
------ Solution ---------------------------------------- ----
action unneeded property plus @ JSON (serialize = false) annotation on the get method .
service interface is not commented out , all the direct return json data will complain of
------ For reference only -------------------- -------------------
Will the problem solved? Now I also have this problem here , hope the wing
------ For reference only ----------------------------- ----------
you solve it?
------ For reference only -------------------------------------- -
encountered the same problem , LZ solved yet , seeking methods
------ For reference only --------------------- properties ------------------
in , specify includeProperties result contains only child objects can filter out unwanted proxy class properties
projectVersions. * \.
没有评论:
发表评论