“java.sql.SQLException:I / O错误:连接重置”在linux服务器上 [英] "java.sql.SQLException: I/O Error: Connection reset" in linux server

查看:304
本文介绍了“java.sql.SQLException:I / O错误:连接重置”在linux服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到oracle数据库的java程序,有时它工作,有时会显示这个错误信息:

I have a java program which connect to oracle database sometimes it work and sometimes show me this error message :

线程main中的异常java.sql.SQLRecoverableException :IO错误:连接重置

Exception in thread "main" java.sql.SQLRecoverableException: IO Error: Connection reset

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:498)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)

我如何解决这个问题?
谢谢。

How i can solve this problem? thanks.

推荐答案

从oracle论坛回答, 此处

Answer took from oracle forum, here:

java.security .SecureRandom 是sun提供的标准API。在这个类提供的各种方法中 void nextBytes(byte [])

java.security.SecureRandom is a standard API provided by sun. Among various methods offered by this class void nextBytes(byte[]).

此方法用于生成随机字节。 Oracle 11g JDBC驱动程序使用此API在
登录期间生成随机数。使用Linux的用户遇到 SQLException(Io例外:连接重置)

This method is used for generating random bytes. Oracle 11g JDBC drivers use this API to generate random number during login. Users using Linux have been encountering SQLException("Io exception: Connection reset").

这个问题有两个问题:


  1. JVM尝试列出/ tmp(或-Djava.io设置的备用tmp目录)中的所有文件。 tmpdir)当
    调用SecureRandom.nextBytes(byte [])时。如果文件数量很大,
    方法需要很长时间
    来响应并因此导致服务器超时

  1. The JVM tries to list all the files in the /tmp (or alternate tmp directory set by -Djava.io.tmpdir) when SecureRandom.nextBytes(byte[]) is invoked. If the number of files is large the method takes a long time to respond and hence cause the server to timeout

方法 void nextBytes(byte [])在Linux上使用/ dev / random,在缺少随机
数生成硬件的某些机器上,操作速度减慢到将整个登录过程带到
a停止。最终用户遇到SQLException(Io例外:
连接重置)

The method void nextBytes(byte[]) uses /dev/random on Linux and on some machines which lack the random number generating hardware the operation slows down to the extent of bringing the whole login process to a halt. Ultimately the the user encounters SQLException("Io exception: Connection reset")

升级到11g的用户如果底层操作系统是运行在故障硬件上的Linux,则会遇到此问题。

Users upgrading to 11g can encounter this issue if the underlying OS is Linux which is running on a faulty hardware.

原因尚未确切确定。它可能是硬件中的问题,也可能是因为某些原因软件无法从 dev / random

The cause of this has not yet been determined exactly. It could either be a problem in the hardware or the fact that for some reason the software cannot read from dev/random

解决方案似乎将此设置添加到jvm

a solution seems to add this setting to the jvm

-Djava.security.egd=file:/dev/./urandom

这篇关于“java.sql.SQLException:I / O错误:连接重置”在linux服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆