org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: null, message from server: "Host '106.14.181.95' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
### The error may exist in com/jxhy/myBatis/sqlMapper/AccountMapper.xml
### The error may involve com.jxhy.myBatis.dao.AccountMapper.selectByExample
### The error occurred while executing a query
### Cause: java.sql.SQLException: null, message from server: "Host '106.14.181.95' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy2.selectByExample(Unknown Source)
at com.jxhy.myBatis.daoImp.AccountDaoImp.selectByExample(AccountDaoImp.java:141)
at com.jxhy.myBatis.services.AccountService.selectAccount(AccountService.java:79)
at com.jxhy.gameserver.msg.processor.login.LoginMsgProcessor.process(LoginMsgProcessor.java:42)
at com.jxhy.gameserver.msg.processor.common.MsgProcessor.handle(MsgProcessor.java:15)
at com.jxhy.gameserver.commons.message.MsgDispatcher.dispatchMsg(MsgDispatcher.java:67)
at com.jxhy.gameserver.net.MinaMsgHandler.messageReceived(MinaMsgHandler.java:43)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
### Error querying database. Cause: java.sql.SQLException: null, message from server: "Host '106.14.181.95' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
### The error may exist in com/jxhy/myBatis/sqlMapper/AccountMapper.xml
### The error may involve com.jxhy.myBatis.dao.AccountMapper.selectByExample
### The error occurred while executing a query
### Cause: java.sql.SQLException: null, message from server: "Host '106.14.181.95' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy2.selectByExample(Unknown Source)
at com.jxhy.myBatis.daoImp.AccountDaoImp.selectByExample(AccountDaoImp.java:141)
at com.jxhy.myBatis.services.AccountService.selectAccount(AccountService.java:79)
at com.jxhy.gameserver.msg.processor.login.LoginMsgProcessor.process(LoginMsgProcessor.java:42)
at com.jxhy.gameserver.msg.processor.common.MsgProcessor.handle(MsgProcessor.java:15)
at com.jxhy.gameserver.commons.message.MsgDispatcher.dispatchMsg(MsgDispatcher.java:67)
at com.jxhy.gameserver.net.MinaMsgHandler.messageReceived(MinaMsgHandler.java:43)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
原因:
同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;
解决方法:
1、使用mysqladmin flush-hosts 命令清理一下hosts文件(不知道mysqladmin在哪个目录下可以使用命令查找:whereis mysqladmin);
① 在查找到的目录下使用命令修改:/usr/bin/mysqladmin flush-hosts -h192.168.0.1 -P3308 -uroot -p;
备注:
其中端口号,用户名,密码都可以根据需要来添加和修改;
配置有master/slave主从数据库的要把主库和从库都修改一遍的;
第二步也可以在数据库中进行,命令如下:flush hosts;