struts2中使用spring的AOP,action返回数据时出现这样的错误,不用AOP时没问题
所有的action及后台的类都是在spring里配置的
<strong>org.apache.struts2.json.JSONException: 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"</strong>
    <div>
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:250)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:164)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:130)
    org.apache.struts2.json.JSONWriter.write(JSONWriter.java:98)
    org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:112)

解决方案 »

  1.   

    Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"楼主可以把相关的代码拿出来看看。
    其实上面的异常已经说的很清楚了,你不应该访问TruePointcut这个类你没有访问权限(因为它并不是一个public类型的)
      

  2.   

    原来我的action里有个logic,这个是spring要依赖注入的,我把这个logic的get方法去掉就可以正常返回了
      

  3.   

    谢谢提供解决方法,我也遇到这个问题,去掉get方法正常了
      

  4.   

    我怎么不行啊  我将类里面所有的get方法都注释了  还是报一样的错啊 !请教了!现在的情况是这样的:jquery的ajax url是一个action,action是有spring接管的 ,现在就是在一步加载的时候报这个异常,下面是异常信息,请指教!
    Struts Problem Report
    Struts has detected an unhandled exception: Messages: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public" 
    java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public" 
    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" 
    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" 
    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" 
     
    File: sun/reflect/Reflection.java 
    Line number: 65 
      

  5.   

    http://hi.baidu.com/whosimplylol/item/bd93329d20884ccbb625315f希望对你有帮助