IOException: Connection reset by peer: JVM_recv in socket input stream read
hi
I encountered a problem : a program throw out an exception:java.io.IOException: Io exception:
Connection reset by peer: JVM_recv in socket input stream read.
I tried my best to resolve it ,but unfortunately,i didn't know what caused the exception.
the following is my application environment:
I have two PC(Win2000os),one is a server which installed oracle9.2.0.2 and jdeveloper9.0.3,the another is a
client which only intalled jdeveloper9.0.3.Two days ago,i performed a web application on my client with
jdeveloper,and it includes some JSP and a javabean files.JSP Page finished uploading client xml file to a
folder on server and the javabean finished loading the xml file into a xmltype column.I can make sure the
connection is established and the javabean is OK,beacause my some jsp page can successfully use
<jsp:usebean> tag and use the javabean's some other public interfaces,except the interface that finishs
loading the xml file into a xmltype(clob) column.
Then i do many tests!I changed the javabean to a java class incluse a main method beacause it is easy to
debug.Finally i found the following code caused the exception:
--------------------------------------------------------
public CLOB writetoClob( CLOB clob, InputStream is )throws SQLException, IOException {
InputStreamReader reader = new InputStreamReader( is );
Writer writer = clob.getCharacterOutputStream( );
char[] buffer = new char[clob.getChunkSize( )];
int charsRead;
for ( charsRead = reader.read( buffer ); charsRead > -1;charsRead = reader.read( buffer ) ) {
writer.write( buffer, 0, charsRead );
}
writer.close();
return clob;
}
------------------------------------------------------
when it runs to writer.close(),the exception is caused!
Then i copy the java class to the server,it runs ok!
That is to say ,the same code,the different result!
But when i run my web application on server with jdeveloper Embedded OC4J Server and a jsp page loaded javabean
and run to mentioned code ,the same exception occured!
I checked the application log in event viewer,the descriptions was:
The data buffer created for the "AppleTalk" service in the "C:\WINNT\system32\atkctrs.dll" library is not
aligned on an 8-byte boundary. This may cause problems for applications that are trying to read the
performance data buffer. Contact the manufacturer of this library or service to have this problem corrected or
to get a newer version of this library.
I search some some resolution about this exception with web and someone sayed :
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.
In general,the following information is conclution:
Web application runs error both on client and on server.
If it was changed to a client java class,it only run ok on server!
i have done anything that i can do now,i feel depressed very much!
how can i resolve the problem!
Any a little help will be appreciated!
regards!
Thanks
Jiawei ZHAO