复杂网络环境下应用与数据库连接报错问题处理ErrorCode17410(No more data to read from socket)

一、问题表象

1.日志显示数据库连接错误(errorCode 17410, state 08000)

2.程序执行异常:数据库初始化失败(init datasource error, url: jdbc:oracle:thin:@IP:1521:orcl java.sql.SQLRecoverableException: No more data to read from socket)

详细日志如下:

2020-05-20 12:51:02
[ERROR]-[Thread: localhost-startStop-1]-[com.alibaba.druid.pool.DruidDataSource.init()]: init datasource error, url: jdbc:oracle:thin:@IP:1521:orcl
java.sql.SQLRecoverableException: No more data to read from socket
        at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)
        at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:669)
        at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:576)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1166)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1461)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1525)
        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:734)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1060)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1056)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:104)
        at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43)
        at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)
        at com.jfinal.core.Config.startPlugins(Config.java:128)
        at com.jfinal.core.Config.configPluginWithOrder(Config.java:71)
        at com.jfinal.core.Config.configJFinal(Config.java:56)
        at com.jfinal.core.JFinal.init(JFinal.java:63)
        at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)

2020-05-20 12:51:02
[ERROR]-[Thread: localhost-startStop-1]-[com.alibaba.druid.pool.DruidDataSource.init()]: {dataSource-2} init error
java.sql.SQLRecoverableException: No more data to read from socket
        at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)
        at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:669)
        at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:576)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1166)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1461)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1525)
        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:734)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1060)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1056)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:104)
        at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43)
        at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)
        at com.jfinal.core.Config.startPlugins(Config.java:128)
        at com.jfinal.core.Config.configPluginWithOrder(Config.java:71)
        at com.jfinal.core.Config.configJFinal(Config.java:56)
        at com.jfinal.core.JFinal.init(JFinal.java:63)
        at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)

二、网络环境分析

三、排查误区

1.只要做过网闸映射,不管目标地址是否可用,网闸测试ip和端口都是通的;(容易引导误以为目标地址可用)

2.要尽量保持测试环境与正式环境高度一致,避免引发其他怀疑,误导问题排查;

四、最终结果

就是因为MTU导致数据包被切片,无法正常返回结果(连接异常,无法获取数据)。

MTU:通信术语 
最大传输单元(Maximum Transmission Unit)是指一种通信协议的某一层上面所能通过的最大数据包大小(以字节为单位)。 
我们在使用互联网时进行的各种网络操作,都是通过一个又一个“数据包”传输来实现的。而MTU指定了网络中可传输数据包的最大尺寸,在我们常用的以太网中,MTU是1500字节。超过此大小的数据包就会将多余的部分拆分再单独传输 。
MTU的设置不是一个值天下通用,所以需要我们合理设置特殊场景的MTU 。

MTU更多信息请参考如下博客:

https://blog.csdn.net/jctian000/article/details/87858470

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值