解析json对象时,使用了new TypeReference()对象 fastjson会对解析的对象类型进行缓存 new TypeReference<ResultData>(){} 使用这种方式后,会导致下面的json对象解析失败,返回jsonObject类型 new TypeReference<ResultData<ItemTO>>(){} 解决方法:对于没有返回值的对象,使用ResultData<Void>,不直接使用ResultData …
com.alibaba.fastjson.JSONObject时经常会用到它的转换方法,包括Java对象转成JSON串.JSON对象,JSON串转成java对象.JSON对象,JSON对象转换Java对象.JSON串等,使用方法总结如下,持续更新... 1.Java对象-->JSON对象 (JSONObject)JSONObject.toJSON(Java对象实例) public class JSON2JavaTest{ public static void main(String[] args…
spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date] 而POST请求,传入时间类型字符串,后台是可以解析成Date类型的. 出现这个错误,在需要接受Date类型的字符串参数的controller层中,加入: @InitBinder public void initBinder(WebDataBinder binder) { S…
org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject 解析服务器返回的Json串时,JSONObject对象抛出了这个异常. 原以为是返回的json格式错误了,仔细对比看不出所以然.至少字符上看是格式没问题的.. 那就可能是编码的问题了.仔细比较每个字符,的确在json串头部发现字符:"\ufeff" . 客户端解决方案: public static final …
org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: org.apache.http.conn.EofSensorInputStream@42b0f150; line: 1, column: 112]…
异常信息如下: JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token…
今天在做 excel导出的时候,出现了一个问题"java.lang.ClassCastException: java.lang.String cannot be cast to com.domain.xxx": 公司用hibernate,查询时候可以用sql和hql,用什么一般看心情,第一次查询用的是select g.* from persion g ,site s where g.wz=s.dz(当然都是简写); 当get实体导出的 时候出现了" java.lang.Cla…
现象: mybatis mapper.xml 的sql里如果直接使用了想要传入的变量,比如: <select id="selectXx" resultType="int" statementType="STATEMENT"> SELECT COUNT(*) FROM B_PERSON WHERE ${columnName} != '' </select> 会出现 There is no getter for propert…
今天在修改一个关于mybtis语句时,偶然发现的一个错误 There is no getter for property named 'id' in class 'java.lang.String', 纠结了许久,终于明白了为什么. 原因:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取 string.xxx 值,如果没在在方法中定义,则会抛异常报错.当然也不是所有的版本会有这个问题,我的项目用的版本比较老. 有两种解决方案: 方案一: 将对应的参数用 _parameter…
况描述: web工程在windows环境eclipse下编译部署没有问题,系统升级时需要运维从Git取相应的源码并编译部署到线上机器,部署启动正常没有错误,当访问业务的action时报错,如下. 错误如下 java.lang.IllegalArgumentException: Name for argument type [java.lang.String] not available, and parameter name information not found in class file…
Spring boot启动时报 java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long错误: java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Longat com.mysql.jdbc.…