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方法加 ...
随机推荐
- spring mvc 多视图配置
<!-- jsp视图解析器--> <bean id="viewResolver" class="org.springframework.web.serv ...
- Java线程间通信--生产者消费者
class ProducerConsumerDemo { public static void main(String[] args) { Resource r = new ...
- (hdu)2444 The Accomodation of Students 判断二分图+最大匹配数
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2444 Problem Description There are a group of s ...
- 九度OJ 1499 项目安排 -- 动态规划
题目地址:http://ac.jobdu.com/problem.php?pid=1499 题目描述: 小明每天都在开源社区上做项目,假设每天他都有很多项目可以选,其中每个项目都有一个开始时间和截止时 ...
- asp.net弹出框后页面走样
1.去掉language='javascript' ,问题依旧 2.后面加上Response.Write("<script>document.location=document. ...
- mac下搭建react-native环境
1.安装Homebrew 2.安装node(最好安装4.x以上版本这样就自带了一个npm) 3.安装npm(node的包管理工具) 一般高版本的npm在安装node的时候已经具有了 4.安装react ...
- Delphi中的GetEnumName和GetEnumValue的使用方法
利用TypInfo单元的GetEnumName和GetEnumValue可以遍历任意枚举类型,并获取其名称和值.下面是示例Demo. uses TypInfo; ... procedure TForm ...
- supervisor---------------------------------常用
第一个 supervisor 的启动 supervisord -c ~/supervisord.conf 这个是如果没有服务没有启动,则使用本脚本启动 进程的设置 [program:blog] ...
- 2016041601 - linux上安装maven
在linux系统中安装maven,个人目前使用ubuntu15.1系统. 要想使用maven,前提条件必须配置好java. 1.检查java信息. 命令:echo $JAVA_HOME 和java - ...
- 【mapping】 springmvc的注解mapping无法生效的问题
springmvc 始终无法加载 注解 map, 解决办法 八月 11, 2015 8:24:42 下午 org.springframework.web.servlet.DispatcherServl ...