Struts2 Action使用Spring的aop后,Action返回Json数据老是报错该如何解决。
Spring的配置文件里我也加上了这句
<aop:aspectj-autoproxy proxy-target-class="true" />
Struts2.xml 也加上了这句
<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="true" />
然后调用时,就报这个错......json数据请求出错
11:36:36,057 ERROR Dispatcher:38 - Exception occurred during processing request: 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.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: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException
at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:246)
at org.apache.struts2.json.JSONWriter.processCustom(JSONWriter.java:178)
at org.apache.struts2.json.JSONWriter.process(JSONWriter.java:168)
at org.apache.struts2.json.JSONWriter.value(JSONWriter.java:134)
at org.apache.struts2.json.JSONWriter.write(JSONWriter.java:102)
at org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:116)
at org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:197)
at org.apache.struts2.json.JSONResult.execute(JSONResult.java:171)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
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:246)
现在的问题是继承 json-default 的Action就会出现问题,而默认继承的Action就不会报错...aop能正常插入
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
json-default把struts-default覆盖了