日期:2014-05-19  浏览次数:20671 次

struts2中使用spring aop时返回json时错误
<li>Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"</li>
  <li>java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"</li>
  <li>org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"</li>
  <li>org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"</li>
  <li>org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"</li>

我不用AOP时是没问题的,我在action里调用另一个后台的类的方法,那个方法加入了AOP,然后返回数据给action,aop在方法执行前后都输出了信息,而在返回的数据也在action可以输出,但是返回给客户户短时就出现了上面的错误,是什么原因了
上面说Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public,
是不是跟pointcut的配置有关系?

------解决方案--------------------
将action中的get*Service()去掉试试,是spring依赖注入的原因