我的系统里用hibernate +spring +struts2 +json 报以下的错,找了一天没有找出来 郁闷了  希望各位大虾帮忙指点一下
javax.servlet.ServletException: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: java.lang.IllegalAccessException: Class com.googlecode.jsonplugin.JSONWriter can not access a member of class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper with modifiers "public"
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)root cause 
com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: com.googlecode.jsonplugin.JSONExeption: java.lang.IllegalAccessException: Class com.googlecode.jsonplugin.JSONWriter can not access a member of class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper with modifiers "public"
com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:206)
com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:143)
com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:113)
com.googlecode.jsonplugin.JSONWriter.write(JSONWriter.java:81)
com.googlecode.jsonplugin.JSONUtil.serialize(JSONUtil.java:62)
com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:118)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)

解决方案 »

  1.   

    <package name="xxxxx" extends="json-default">
    <result type="json"></result>
      

  2.   

    这是json,  struts-plugin.xml内容
    <struts>
        <package name="json-default" extends="struts-default">
            <result-types>
                <result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
            </result-types>
            <interceptors>
                <interceptor name="json" class="com.googlecode.jsonplugin.JSONInterceptor"/>
            </interceptors>
        </package>
    </struts>
      

  3.   

    这是我的struts.xml
    ,应该没什么错吧
    <struts>
        <include file="struts-default.xml"/>
           <package name="com.json"  extends="json-default" namespace="/jsp/fangtan">  
              <action name="fangtanroomJson" class="com.founder.edu.action.FangtanroomJson">  
                <result  type="json"/>  
            </action>  
           
          </package>  </struts> 
      

  4.   

    楼主解决了么?我也发生类似问题,貌似是struts2-spring-plugin-2.0.11.jar包和什么包冲突,楼主解决了的话通知一声啊,   我的邮箱是 [email protected]
      

  5.   

    把spring dao 接口的get方法去掉就可以了,就是action里面调用的接口
      

  6.   

    就是action里面spirng 依赖注入的接口
      

  7.   

    在action里面不能包含有接口的get方法, 
      

  8.   

    可以使用@JSON(serialize=false)注解 将get方法注释掉,就是不让该类 序列化,亲自测试已经通过。
      

  9.   

    是不是action里面有集合类属性,而且有 setter 方法?
      

  10.   

    在action里的getdao加一个注解@JSON(serialize=false)