Class org.apache.struts2.json.JSONWriter can not access a member of class
来源:互联网 发布:淘宝代运营公司诈骗 编辑:程序博客网 时间:2024/06/07 12:12
异常形式:
Class org.apache.struts2.json.JSONWriter can not access a member of
或是 Class com.googlecode.jsonplugin.JSONWriter can not access a member of class
第一种是struct2.1.8与json结合时的异常,第二种是struct2.1.6与json结合的异常。
具体异常信息 :
Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.BaseResultSet with modifiers “public”
解释:
不能把程序中的某种数据结构串行化成json格式。
原因:
struts2的action里面的数据转换成json数据时,会将提供了get方法的属性都串行化输出JSON到客户端。有的时候,很多属性并不能串行化成json数据,比如这里的oracle.jdbc.driver.BaseResultSet。这时还进行强行转换就会出现这样的异常。
解决方法:
在不能串行化到json的属性相应的get方法前加一条json标记 @JSON(serialize=false)。告诉json不需要转化这个属性。或者根本不写这个,但是也不能多加,多加了有时候也会报异常,一般在ssh 项目的XXXService中的get方法上需要加这个@JSON(serialize=false)get方法。
后记:
对于不需要在前台输出的json数据,也可以用同样的方法进行处理,从而减少服务器和客户端间交互的信息量。
可在需要在前台输出的属性的get方法前加上@JSON(name=“status”)标识,从而为该属性起了一个别名,在前台就可以通过status作为属性名来读取其值。
点击可以查看原文连接,文略有删改
- Class org.apache.struts2.json.JSONWriter can not access a member of class
- Class org.apache.struts2.json.JSONWriter can not access a member of class
- org.apache.struts2.json.JSONWriter can not access a member of class org.apache.commons.dbcp...
- Class org.apache.struts2.json.JSONWriter can not access a member of *(转)
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- org.apache.struts2.json.JSONWriter can not access a member of class
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- Class org.apache.struts2.json.JSONWriter can not access a member of *
- 遇到问题---org.apache.struts2.json.JSONWriter can not access a member of class
- org.apache.struts2.json.JSONWriter can not access a member of class
- Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.in
- Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.Physica
- Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.Physica
- org.apache.struts2.json.JSONWriter can not access a member of class org.apache.commons.dbcp.PoolingD
- Oracle中的SQL分页查询原理和方法详解
- 12_opengl学习
- gulp 安装 gulp-css-spriter
- 【python学习笔记】Dataframe和类SQL的merge函数(一)
- UVA11802-All Your Bases Belong to Us
- Class org.apache.struts2.json.JSONWriter can not access a member of class
- 微信图片预览的小经验
- mui框架 页面无法滚动解决方法
- hive安装过程全程解析、hive常规操作、说明
- 最不擅长等分布局
- hive UDF实操及解析说明
- iOS 简单工厂模式、抽象工厂模式~详解
- 关于phantomjs evaluate沙盒环境的点击事件
- myisamchk命令使用总结