Connection reset by peer:jvm_recv in socket

am programming in Jbuilder7 and weblogic 7. I created a jdbc datasource of a postgres database. In the ejb, I lookup the jndi and get connection to execute a query to get some data and return the ArrayList of data. I also created a servlet to lookup the ejb and get the ArrayList. It always work fine after I restart computer that the server is running. But if I leave it 4 or 5 hours, in the server window, it always appear error in the ejb function “executequery” after I lookup the jndi, get connection and createstatement. The error is:

An I/O error occured while reading from backend – Exception:
ocketException: Connection reset by peer: JVM_recv in socket input stream read
Stack Trace: Connection reset by peer: JVM_recv in socket input str
eam read
at Method)
at org.postgresql.PG_Stream.ReceiveChar(
at org.postgresql.core.QueryExecutor.execute(
at org.postgresql.Connection.ExecSQL(
at org.postgresql.jdbc2.Statement.execute(
at org.postgresql.jdbc2.Statement.executeQuery(
at weblogic.jdbc.pool.Statement.executeQuery(
at weblogic.jdbc.rmi.internal.StatementImpl.executeQuery(StatementImpl.j
at weblogic.jdbc.rmi.SerialStatement.executeQuery(
at com.panda.ejb.categorydatamanager.CategoryBean.GetCategory(CategoryBe
at com.panda.ejb.categorydatamanager.CategoryBean_9ra2ge_EOImpl.GetCateg
at com.panda.ejb.categorydatamanager.CategoryBean_9ra2ge_EOImpl_WLSkel.i
nvoke(Unknown Source)

Please help me. I have not any ideas about it. Thanks.



RE:Connection reset by peer:jvm_recv in socket


Do you have a firewall in the network between the application and database server? Maybe this error is due to the closing of the connection by the firewall (timeout after inactivation).

I am having the same problem, but it had never happened before after 3 years of production use of a connection pooling framework. In fact, the database and application servers are separated by the Internet…

I am trying to find a way to check for a link-failure event in Java.

You should also watch topic “ORACLE driver: timeout => Connection reset by peer: socket write error ?”




Connection Reset by Peer :

One of the issues that developers frequently run into is the Connection reset by peer exception:

Exception in thread “main”
Connection reset by peer: JVM_recv in socket input stream read.

This basically means that a network error occurred while the client was receiving data from the server. But what is really happening is that the server actually accepts the connection, processes the request, and sends a reply to the client. However, when the server closes the socket, the client believes that the connection has been terminated abnormally because the socket implementation sends a TCP reset segment telling the client to throw away the data and report an error.

Sometimes, this problem is caused by not properly closing the input/output streams and the socket connection. Make sure you close the input/output streams and socket connection properly. If everything is closed properly, however, and the problem persists, you can work around it by adding Thread.sleep(1000) before closing the streams and the socket. This technique, however, is not reliable and may not work on all systems.



Try to have a look at this similar topic, expecially at answer 1.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.