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 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不需要转化这个属性。或者根本不写这个get方法。
后记:
对于不需要在前台输出的json数据,也可以用同样的方法进行处理,从而减少服务器和客户端间交互的信息量。
可在需要在前台输出的属性的get方法前加上@JSON(name="status")标识,从而为该属性起了一个别名,在前台就可以通过status作为属性名来读取其值。
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.springframework.aop.TruePointcut with modifiers "public"
Spring注入Action使用Json错误:org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: ...
- 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.tomcat.dbcp.db ...
- Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.Physica
产生这个错误的原因是因为我的oracle数据库中有一个CLOB字段,查询出来的时候要转换为JSON而报错. Class org.apache.struts2.json.JSONWriter can n ...
- 解决json结合struts2时,Class org.apache.struts2.json.JSONWriter can not access a member of * 的问题
在使用json的时候,产生的一个错误,查了一下资料,原来是struts2和json一起使用的时候,才产生的问题,虽然不影响程序的运行,但是总是会有一些异常的日志产生,并且,这个也会增加程序的负担. 原 ...
- struts2 java.lang.StackOverflowError org.apache.struts2.json.JSONWriter
1. 问题描述: 页面通过异步访问action, action的方法通过map封装数据,struts的result的type设置为json,后台报错 六月 25, 2016 6:54:33 下午 ...
- Struts2 项目 Action 查询结果异常 org.apache.struts2.json.JSONException
问题描述 今天进行一个订单管理模块的开发时遇到一个问题:查询的订单时有时会报这个异常: org.apache.struts2.json.JSONException: java.lang.Illegal ...
- root cause:org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException
今天在调试SSH与Ajax时,服务器端报出JSON异常:
- EXT4+Struts2 JSON的问题
ERROR : Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframewor ...
- struts2 json 定义全局Date格式
使用struts2的json插件时,自己定义日期格式经常使用的方式是在get属性上加入@JSON注解,这个对于少量Date属性还能够,可是假设date字段多了,总不可能去给每一个date get方法加 ...
随机推荐
- struts2的java文件中不能直接弹出script对话框
需要引入接口 ServletResponseAware public class Login extends ActionSupport implements SessionAware,Servlet ...
- LinqToExcel常用对象
1.ExcelQueryFactory对象(1)获取工作表名集合IEnumerable<string> GetWorksheetNames() //获取工作薄中的工作表名 foreach ...
- Winform TreeView控件技巧
在开发的时候经常使用treeview控件来显示组织结构啊,目录结构啊,通常会结合属性checkedboxs,来做选中,取消的操作下面是一个选中,取消的小例子,选中节点的时候,如果节点存在子节点,可以选 ...
- Android开发框架
AsyncHttpClient 它把HTTP所有的通信细节全部封装在了内部,我们只需要简单调用几行代码就可以完成通信操作 Universal-Image-Loader 它使得在界面上显示网络图片的操作 ...
- NodeJS+ExpressJS+SocketIO+MongoDB应用模板
OS:Win8.1 with update 关键字:NodeJS,ExpressJS,SocketIO,MongoDB. 1.源代码下载:https://github.com/ldlchina/ESM ...
- Codeforces 55D Beautiful Number
Codeforces 55D Beautiful Number a positive integer number is beautiful if and only if it is divisibl ...
- Centos 6.2上安装使用 Informix11.70 数据库
环境要求:操作系统: Centos 6.2 32位数据库软件: iif.11.70.UC7IE.Linux-RHEL5.tar(在IBM网站上注册个帐号就可以下载,包括windows,Linux,Un ...
- Java学习--final与static
final是java的关键字,它所表示的是“这部分是无法修改的”. 编译期常量,它在类加载的过程就已经完成了初始化,所以当类加载完成后是不可更改的,编译期可以将它代入到任何用到它的计算式中,也就是说可 ...
- 通知NSNotificationCenter
注意:接受通知要写在 viewDidLoad 方法里面 取得系统全局的唯一广播站 NSNotificationCenter *notification = [NSNotificationCenter ...
- caffe之(五)loss层
在caffe中,网络的结构由prototxt文件中给出,由一些列的Layer(层)组成,常用的层如:数据加载层.卷积操作层.pooling层.非线性变换层.内积运算层.归一化层.损失计算层等:本篇主要 ...