[B cannot be cast to java.lang.String
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy22.getAllNoticeList(Unknown Source)
昨天一下午找的bug。这个错误代码,百度谷歌了一下。大概都能知道是什么原因导致的错误。可是有些错误是非常细了。就比方这个。因此记录下来,希望以后不要再犯。
先贴上之前百度的。
这个错误通常是类型不匹配。详细的什么类型,要看你的是什么数据了,从数据库中查询的数据是乱码。可是数据库里显示的是正常的utf-8,原因在于用到了嵌套查询,嵌套查询中使用了中文字符串拼接。然后就斯巴达了,事实上这个错误非常easy避免的,由于測试的时候用的本地数据库才出现的,用server的数据库嵌套查询不会出现乱码。应该是MySql的设置问题。可是能够通过sql语句中增加编码来解决,就是这样。
[B cannot be cast to java.lang.String的更多相关文章
- Mybatis的失误填坑-java.lang.Integer cannot be cast to java.lang.String
Mybatis的CRUD小Demo 为方便查看每次的增删改结果,封装了查询,用来显示数据库的记录: public static void showInfo(){ SqlSession session ...
- org.springframework.cache.interceptor.SimpleKey cannot be cast to java.lang.String
springboot整合redis时,使用@Cacheable注解,如果方法的key参数为空,就会报org.springframework.cache.interceptor.SimpleKey ca ...
- 数据转换失败 java.math.BigDecimal cannot be cast to java.lang.String
从接口获取到数据,在转换的时候出现错误:java.math.BigDecimal cannot be cast to java.lang.String 因为一开始用的是使用关键字进行强制转换,后来发现 ...
- “无效数字” ;java.lang.Integer cannot be cast to java.lang.String
今天页面上突然查询不出数据,大致的sql语句是 select xx ,xxx from table a where a.lrmb in ( 6101060033, 61010503300, 61016 ...
- 42-字符串到json 的错误 com.alibaba.fastjson.JSONObject cannot be cast to java.lang.String
json: {"updated_at":1551780617,"attr":{"uptime_h":3,"uptime_m&quo ...
- java.lang.ClassCastException: java.lang.Short cannot be cast to java.lang.String(Short类型无法强转成String类型)
有一行Java代码如下: String code1 = (String)qTable1.getValueAt(i, 0); 这是一个Java的图形界面获取表格中值的代码,其中qTable1.getVa ...
- 数据转换bug花了半天时间 Java.math.BigDecimal cannot be cast to java.lang.String
从数据库取出一个 Count函数 统计的值 在代码中要转成Integer类型的时候 Integer.parseInt((String)map.get("ID_")) 报了一下错误: ...
- JSONObject转换Int类型--java.lang.Integer cannot be cast to java.lang.String
参数 params={"abc":0} JSONObject转换Int类型 JSONObject json = JSONObject.fromObject(params); if ...
- java 解决 java.lang.Integer cannot be cast to java.lang.String
1.在执行代码打印map的value时,提示错误java.lang.Integer cannot be cast to java.lang.String,这个错误很明显是类型转换错误 查看表字段的数 ...
- [Ljava.lang.String; cannot be cast to java.lang.String报错的原因
完整错误信息: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String 报这个错的原因 ...
随机推荐
- Python3基础笔记---面向对象
只是对一些新的知识的记录 1.创建类 class ClassName: <statement-1> . . . <statement-N> 类实例化后,可以使用其属性,实际上, ...
- MVC 设计模式
MVC 设计模式: 最早由 Trygve Teenskaug 在 1978 年提出,上世纪 80 年代是程序语言 Smalltalk 的一种内部架构.后来 MVC 被其他领域借鉴,成为了软件工程中的一 ...
- 特斯拉正加快部署第三代Autopilot自动驾驶计算机
新浪科技讯,北京时间 4 月 10 日下午消息,据电动汽车新闻网站 Electrek 报道,特斯拉正在加快部署第三代 Autopilot 自动驾驶计算机,因为当前一代产品的计算能力即将被耗尽. 201 ...
- 【codeforces 22C】 System Administrator
[题目链接]:http://codeforces.com/problemset/problem/22/C [题意] 给你n个点; 要求你构造一个含m条边的无向图; 使得任意两点之间都联通; 同时,要求 ...
- java用freemarker实现导出word----包含图片
分为以下三个步骤: 1.先制作word模板 2.将该文档另存为 xml 文件 3.打开xml 文件 将对应的字段替换,比如 4.将xml文件保存成ftl格式的文档 5.相应的代码: package o ...
- hdu 5277 YJC counts stars
hdu 5277 YJC counts stars 题意: 给出一个平面图,n个点,m条边,直线边与直线边之间不相交,求最大团的数目. 限制: 1 <= n <= 1000 思路: 因为平 ...
- UVALive 6084 Happy Camper(数学题)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- 一步一步跟我学习lucene(19)---lucene增量更新和NRT(near-real-time)Query近实时查询
这两天加班,不能兼顾博客的更新.请大家见谅. 有时候我们创建完索引之后,数据源可能有更新的内容.而我们又想像数据库那样能直接体如今查询中.这里就是我们所说的增量索引.对于这种需求我们怎么来实现呢?lu ...
- Xshell高级后门完整分析报告
Xshell高级后门完整分析报告 from:https://security.tencent.com/index.php/blog/msg/120 1. 前言 近日,Xshell官方发布公告称其软件中 ...
- Conditionals
1. Modulus operator (%) The modulus operator works on integers and yields the remainder when the fir ...