阿里云 java程序 链接redis 报错 : IO Error: Connection reset
2018-03-07 17:33:41.224 ERROR [main][Worker.java:26] - catching
java.sql.SQLRecoverableException: IO Error: Connection reset
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:421) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:148) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:211) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:142) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1377) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1431) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:632) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:934) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:930) ~[druid-1.0.15.jar:1.0.15]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:102) ~[druid-1.0.15.jar:1.0.15]
at com.dragon.terminal.common.db.ConnectionPool.getConnection(ConnectionPool.java:71) ~[terminal-system-common-3.1.0.Final.jar:?]
at com.dragon.terminal.worker.dao.DeviceStatusDao.getTotalCount(DeviceStatusDao.java:273) ~[terminal-system-worker-3.1.0.Final.jar:?]
at com.dragon.terminal.worker.DeviceStatusInitializer.initialize(DeviceStatusInitializer.java:50) ~[terminal-system-worker-3.1.0.Final.jar:?]
at com.dragon.terminal.worker.Worker.start(Worker.java:23) [terminal-system-worker-3.1.0.Final.jar:?]
at com.dragon.terminal.server.TerminalServer30.main(TerminalServer30.java:19) [terminal-system-server-3.1.0.Final.jar:?]
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115) ~[?:1.8.0_144]
at java.net.SocketOutputStream.write(SocketOutputStream.java:155) ~[?:1.8.0_144]
at oracle.net.ns.DataPacket.send(DataPacket.java:199) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:211) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:227) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.net.ns.NetInputStream.read(NetInputStream.java:175) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.net.ns.NetInputStream.read(NetInputStream.java:100) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.net.ns.NetInputStream.read(NetInputStream.java:85) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:122) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:78) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1155) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359) ~[ojdbc6-11.2.0.jar:11.2.0.1.0]
... 18 more
原因
- 响应慢,阿里云CentOS7 最小化安装 默认没安装嫡服务器
启动java 程序 链接redis 时间过长,导致启动失败。解决方法如下:
解决方案
# yum install rng-tools
# echo 'EXTRAOPTIONS="-i -o /dev/random -r /dev/urandom -t 10 -W 2048"' > /etc/sysconfig/rngd
# systemctl enable rngd.service
# systemctl restart rngd.service