jquery Ajax 返回JSON报错: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetExce
这个错误是因为我的Service层在注入Action的时候让自动生成了Get、Set方法,问题就出在Get方法上。返回的JSON对象也将这个Get方法当作类实体的属性来返回。
就会报错:org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException
org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:243)
org.apache.struts2.json.JSONWriter.process(JSONWriter.java:165)
org.apache.struts2.json.JSONWriter.value(JSONWriter.java:131)
org.apache.struts2.json.JSONWriter.write(JSONWriter.java:99)
org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:112)
org.apache.struts2.json.JSONResult.execute(JSONResult.java:198)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.Defaul…
--------------------------------------------------------------------------------------------------------------------------------------------------------------
最后将这个Get方法去掉,OK运行正常。
折腾了我半天 记录下
更多推荐
所有评论(0)