四月 12, 2017 3:47:52 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [SpringMVC] in context with path [/yuyi] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error updating database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unsupported character encoding 'utf8mb4'.)

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unsupported character encoding 'utf8mb4'.)] with root cause

java.sql.SQLException: Unsupported character encoding 'utf8mb4'.

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918)

at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:572)

at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:717)

at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:700)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2720)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2781)

at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1569)

at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:4218)

at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3613)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2554)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)

at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)

at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)

at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)

at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)

at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)

at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)

at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)

at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:81)

at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)

at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279)

at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:72)

at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47)

at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105)

at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71)

at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152)

at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

at com.sun.proxy.$Proxy13.insert(Unknown Source)

at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240)

at com.wanyu.frame.base.BaseMyIbatisDao.save(BaseMyIbatisDao.java:198)

at com.wanyu.yuyi.dao.CommentDao.saveOrUpdate(CommentDao.java:29)

at com.wanyu.yuyi.dao.CommentDao.saveOrUpdate(CommentDao.java:1)

at com.wanyu.frame.base.BaseManager.saveOrUpdate(BaseManager.java:68)

at com.wanyu.yuyi.controller.CommentController.AddConment2(CommentController.java:274)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

问题原因:

产生这个问题的原因是为解决  表情的问题,尝试在JDBC连接字符串中指定编码,但是不支持。

解决方法:

参考:MySQL 解决 emoji表情 的方法,使用utf8mb4 字符集(4字节 UTF-8 Unicode 编码)

相关阅读

utf8mb4 字符集(4字节 UTF-8 Unicode 编码)

CentOS下安装MySQL,Windows下使用Navicat for MySql连接

MySQL学习(二)图形界面管理工具Navicat for MySQL安装和使用

java.sql.SQLException: Unsupported character encoding 'utf8mb4'.的更多相关文章

  1. java.sql.SQLException: ORA-00911: invalid character 解决方法

    java.sql.SQLException: ORA-00911: invalid character 控制台抛出这个异常:java.sql.SQLException: ORA-00911: inva ...

  2. 表情存储异常--mybatis抛出异常(java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for column 'name' at row 1)

    文章参考 https://blog.csdn.net/junsure2012/article/details/42171035 https://www.cnblogs.com/WangYunShuai ...

  3. 带emoji表情弹出层的评论框,semantic+emoji picker,java.sql.SQLException: Incorrect string value: '\xF0\x9F..'

    在自己做一个项目玩时,在做评论的时候. 选中了semantic.js原型,这个在国内用的不是很多,但是在github上star数量很高,想当初我想找一个js框架是就在上面找的. semantic中文网 ...

  4. mybatis抛出异常(java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for column 'name' at row 1)

    文章参考 https://blog.csdn.net/junsure2012/article/details/42171035 https://www.cnblogs.com/WangYunShuai ...

  5. java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

    查询视图时报错:java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_ ...

  6. MySQL添加中文字符集问题 --- java.sql.SQLException: Incorrect string value

    今天在做开关记录的时候,数据库表中description字段用于记录当前版本的描述(需要存储中文),在测试程序的时候发现如果用户输入中文,那么后台会报错.错误信息如下: java.sql.SQLExc ...

  7. Error getting nested result map values for 'company'. Cause: java.sql.SQLException: Invalid value for getInt() - 'NFHK188'

    我今天遇到一个我不解的问题,是mybatis多对一关系查询出问题了,但是我自己还是解决了,在网上也查过那个错误,可是找不到我想要的.不知道你们遇到过没有,我接下来分享给大家.希望我这个第一篇博客能帮助 ...

  8. JavaWeb:c3p0配置问题-----java.sql.SQLException: Connections could not be acquired from the underlying database!

    错误原因 c3p0的配置错误 错误显示 -classpath "D:\Program\Software\IntelliJIDEA\IntelliJ IDEA 2018.2.5\lib\ide ...

  9. java.sql.SQLException: Incorrect string value: '\xE5\xB0‘

    mysql插入中文字符报java.sql.SQLException: Incorrect string value: '\xE5\xB0‘ #原因:由于默认情况下,mysql的字符集是latin1(I ...

随机推荐

  1. 20145322 《Java程序设计》第6周学习总结

    20145322 <Java程序设计>第6周学习总结 教材学习内容总结 第十章 10.1.1 串流设计的概念 Java将输入/输出抽象化为串流,数据有来源及目的地,衔接两者的是串流对象. ...

  2. openssl 编译

    不要费事编译了,直接下载吧! https://www.npcglib.org/~stathis/blog/precompiled-openssl/ 下载 openssl https://www.ope ...

  3. eclipse 工程没有build path

    项目的.project文件添加: <buildSpec><buildCommand><name>org.eclipse.jdt.core.javabuilder&l ...

  4. rocketmq事务消息

    rocketmq事务消息 参考: https://blog.csdn.net/u011686226/article/details/78106215 https://yq.aliyun.com/art ...

  5. C# Memcached 缓存

    之前做的功能,程序可能有不足之处,但还是要记录下 ICacheStrategy.cs文件 public interface ICacheStrategy { /// <summary> / ...

  6. 一致性hash演示

    看到点关于一致性hash的说明,觉得挺有意思,就想体验一下. 上代码看看,体会一下在一致性hash环境下的cache和获取. 因为是小代码演示,没有很细致,包括hash函数就是用取余操作,但活生生的显 ...

  7. 通过spring整合activeMQ实现jms实例

    写的很详细 http://blog.csdn.net/leonardo9029/article/details/43154385

  8. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/usr/local/mysql/tmp/mysql.sock'

    查看是否开启服务 # ps -ef | grep mysql root 5605 5457 0 11:45 pts/2 00:00:00 grep mysql 查看my.cnf # cat /etc/ ...

  9. 简化Kubernetes应用部署工具-Helm

    [编者的话]微服务和容器化给复杂应用部署与管理带来了极大的挑战.Helm是目前Kubernetes服务编排领域的唯一开源子项目,做为Kubernetes应用的一个包管理工具,可理解为Kubernete ...

  10. 【平台中间件】Nginx安装配置,实现版本更新不影响服务访问

    为什么要做负载均衡? 当你网站是一个企业站.个人博客的时候,或者访问量比较小的时候,一台服务器完全应付的了,那就完全没必要做负载均衡.但是,如果你的网站是平台级别,用户达到十万百万级别了,一台服务器明 ...