You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Miguel Carvalho <mc...@infopulse.pt> on 2001/09/20 19:52:10 UTC
Connection aborted by peer: socket write error! Please Help me!
I'm tring to put a file in a webdav folder in my project. For experience
I read a file from disk. If I do it in a single project, in a test
class, everithing goes well.
But I wan't to do do it in a Servlet environment. Using ServletServer
that comes with jBuilder with the same exact code I get an exception.
I've tried also with Jrun, TomCat and the same happens.
Code and Exception fallows:
InputStream input_stream = new FileInputStream(path+"/"+name);
...
File temp_file = new File(temp_files_path, filename);
BufferedReader in = new BufferedReader(new
InputStreamReader(input_stream));
PrintWriter out = new PrintWriter(new BufferedWriter(new
FileWriter(temp_file)));
while (in.ready())
out.write(in.read());
in.close();
out.flush();
out.close();
try {
method.sendData(temp_file);
client.executeMethod(method);
temp_file.delete();
}
catch(Exception ex){ex.printStackTrace();}
}
This works fine standalone. But in servlet environment I get:
java.net.SocketException: Connection aborted by peer: socket write error
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
at
org.apache.commons.httpclient.RequestOutputStream.write(RequestOutputStr
eam.java:281)
at
org.apache.commons.httpclient.methods.PutMethod.streamQuery(PutMethod.ja
va:255)
at
org.apache.commons.httpclient.HttpClient.sendRequestBody(HttpClient.java
:1012)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
07)
...
I'm using Jakarta-Slide1.0.14 release in JDK1.3. . I've tried with
Crimson.jar+jaxp.jar, and with Xerces.
Please help me, it's the only problem I have now. My project it's
finished and I need to solve this so I can graduate.
THANKS IN ADVANCE,
Regards
Maik
----------------------------------------------------------
Miguel Carvalho
----------------------------------------------------------
Infopulse Portugal
Praça dos Poveiros 56 2º Salas 4-8
4000 393 Porto
Portugal
Tel:+351 22 3389103
Fax:+351 22 3389104
http://www.infopulse.pt
----------------------------------------------------------
The Netherlands: http://www.infopulse.nl
Romania: http://www.infopulse.ro
----------------------------------------------------------
icq: 48259534
odigo: 1464770
yahoo_id : maik_pt
----------------------------------------------------------
----------------------------------------------------------
Miguel Carvalho
----------------------------------------------------------
Infopulse Portugal
Praça dos Poveiros 56 2º Salas 4-8
4000 393 Porto
Portugal
Tel:+351 22 3389103
Fax:+351 22 3389104
http://www.infopulse.pt
----------------------------------------------------------
The Netherlands: http://www.infopulse.nl
Romania: http://www.infopulse.ro
----------------------------------------------------------
icq: 48259534
odigo: 1464770
yahoo_id : maik_pt
----------------------------------------------------------
RE: Connection aborted by peer: socket write error! Please Help me!
Posted by Miguel Carvalho <mc...@infopulse.pt>.
Well, since you have tested that simple example, I believe the problem
can be the server! I'm interacting with MS IIS 5 (you mus't have missed
it in log files i've sent). It dosen't makes any sense those reconnects,
does it? I'm thinking about to try tomcat as server (you missunderstood
me, i used tomcat for test but only to run client servlet, the dav dirs
where in iis). do you know any howto install tomcat slide dav enabled?
i've tried it some months ago, but i had some troble to make it work
out. That's why i started using iis (bah).
Regards,
Miguel Carvalho (mcarvalho@infopulse.pt)
Infopulse Portugal
Praca dos Poveiros 56 2o Salas 4-8
4000 393 Porto
Portugal
Tel:+351 22 3389103
Fax:+351 22 3389104
http://www.infopulse.pt
-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be]
Sent: sexta-feira, 21 de Setembro de 2001 19:58
To: slide-user@jakarta.apache.org
Subject: Re: Connection aborted by peer: socket write error! Please Help
me!
Miguel Carvalho wrote:
> Hi! I've followed your suggestion Dirk. Debug mode didn't help me very
> much.
>
> I separated the webdav put tests from all the remaining process so I
> can trace package crossovers better. I've tried this With several
> combinations of need packages, and diferent webservers:
>
> WebServers: ServletServer, Jrun, TomCat;
> Servlet classes: jsdk.jar (2.0), Servlet.jar (2.2 and 2.3).
>
> Xml: Xerces 1_3_1 versus jaxp.jar + crimson.jar (slide).
>
> And I allways get the same results. I don't know if in Jrun case som
> libraries may make interferience.
>
> Please se the atacched files. The Test2.java first. It's the simple
> example, that works fine TestServlet.java it's the same code in a
> servlet. When putting small files (<100KB) it succeded but don't
> writes anithyng. Putting larger files it gives the output in the log
> files.
>
> TIA,
Your TestServlet works for me... :-)
I compiled your example using servlet.jar(2.2) and the latest cvs
version of httpclient. Looking at your example, I think you are using
Tomcat 4 as your webdav server ?
I did the following:
- changed following lines in your example
System.out.println("temp_file path: " +
temp_file.getAbsolutePath());
System.out.println("temp_file length: " + temp_file.length());
method.sendData(temp_file);
client.setDebug(1000);
client.executeMethod(method);
- used "http://localhost:8080/webdav" as http_url
- compiled TestServlet and put it in:
jakarta-tomcat-4.0-b7\webapps\examples\WEB-INF\classes
- put the following libraries in
jakarta-tomcat-4.0-b7\webapps\examples\WEB-INF\lib
crimson.jar,jaxp.jar,commons-httpclient.jar,webdavlib.jar
(both httpclient and webdavlib from slide cvs)
- run the servlet using:
http://localhost:8080/examples/servlet/TestServlet
The servlet works and gives "sucess!", on the log I get:
=============================================
Starting service Tomcat-Standalone
Apache Tomcat/4.0-b7
Starting service Tomcat-Apache
Apache Tomcat/4.0-b7
temp_file path: D:\Temp\dontwork.exe
temp_file length: 625181
Reopen connection : Host:localhost Port:8080
PUT /webdav/dontwork.exe HTTP/1.1
Transfer-Encoding: chunked
Host: localhost:8080
User-Agent: Jakarta HTTP Client/1.0
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Content-Type: text/html; charset=UTF-8
Date: Fri, 21 Sep 2001 17:40:32 GMT
Transfer-Encoding: chunked
Server: Apache Tomcat/4.0-b7 (HTTP/1.1 Connector)
============================================
As you can see the client doesn't have to reopen the connection in my
case. What is your precise webdav server configuration ?
Dirk
Re: Connection aborted by peer: socket write error! Please Help me!
Posted by Dirk Verbeeck <di...@pandora.be>.
Miguel Carvalho wrote:
> Hi! I've followed your suggestion Dirk. Debug mode didn't help me very
> much.
>
> I separated the webdav put tests from all the remaining process so I can
> trace package crossovers better. I've tried this
> With several combinations of need packages, and diferent webservers:
>
> WebServers: ServletServer, Jrun, TomCat;
> Servlet classes: jsdk.jar (2.0), Servlet.jar (2.2 and 2.3).
>
> Xml: Xerces 1_3_1 versus jaxp.jar + crimson.jar (slide).
>
> And I allways get the same results. I don't know if in Jrun case som
> libraries may make interferience.
>
> Please se the atacched files. The Test2.java first. It's the simple
> example, that works fine TestServlet.java it's the same code in a
> servlet. When putting small files (<100KB) it succeded but don't writes
> anithyng. Putting larger files it gives the output in the log files.
>
> TIA,
Your TestServlet works for me... :-)
I compiled your example using servlet.jar(2.2) and the latest cvs version of httpclient.
Looking at your example, I think you are using Tomcat 4 as your webdav server ?
I did the following:
- changed following lines in your example
System.out.println("temp_file path: " + temp_file.getAbsolutePath());
System.out.println("temp_file length: " + temp_file.length());
method.sendData(temp_file);
client.setDebug(1000);
client.executeMethod(method);
- used "http://localhost:8080/webdav" as http_url
- compiled TestServlet and put it in: jakarta-tomcat-4.0-b7\webapps\examples\WEB-INF\classes
- put the following libraries in jakarta-tomcat-4.0-b7\webapps\examples\WEB-INF\lib
crimson.jar,jaxp.jar,commons-httpclient.jar,webdavlib.jar
(both httpclient and webdavlib from slide cvs)
- run the servlet using: http://localhost:8080/examples/servlet/TestServlet
The servlet works and gives "sucess!", on the log I get:
=============================================
Starting service Tomcat-Standalone
Apache Tomcat/4.0-b7
Starting service Tomcat-Apache
Apache Tomcat/4.0-b7
temp_file path: D:\Temp\dontwork.exe
temp_file length: 625181
Reopen connection : Host:localhost Port:8080
PUT /webdav/dontwork.exe HTTP/1.1
Transfer-Encoding: chunked
Host: localhost:8080
User-Agent: Jakarta HTTP Client/1.0
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Content-Type: text/html; charset=UTF-8
Date: Fri, 21 Sep 2001 17:40:32 GMT
Transfer-Encoding: chunked
Server: Apache Tomcat/4.0-b7 (HTTP/1.1 Connector)
============================================
As you can see the client doesn't have to reopen the connection in my case.
What is your precise webdav server configuration ?
Dirk
RE: Connection aborted by peer: socket write error! Please Help me!
Posted by Miguel Carvalho <mc...@infopulse.pt>.
Hi! I've followed your suggestion Dirk. Debug mode didn't help me very
much.
I separated the webdav put tests from all the remaining process so I can
trace package crossovers better. I've tried this
With several combinations of need packages, and diferent webservers:
WebServers: ServletServer, Jrun, TomCat;
Servlet classes: jsdk.jar (2.0), Servlet.jar (2.2 and 2.3).
Xml: Xerces 1_3_1 versus jaxp.jar + crimson.jar (slide).
And I allways get the same results. I don't know if in Jrun case som
libraries may make interferience.
Please se the atacched files. The Test2.java first. It's the simple
example, that works fine TestServlet.java it's the same code in a
servlet. When putting small files (<100KB) it succeded but don't writes
anithyng. Putting larger files it gives the output in the log files.
TIA,
Miguel Carvalho (mcarvalho@infopulse.pt)
Infopulse Portugal
Praça dos Poveiros 56 2º Salas 4-8
4000 393 Porto
Portugal
Tel:+351 22 3389103
Fax:+351 22 3389104
http://www.infopulse.pt
Re: Connection aborted by peer: socket write error! Please Help me!
Posted by Dirk Verbeeck <di...@pandora.be>.
Normally, running this code in a servlet environment shouldn't make a
difference.
There are 2 things you can do:
- check the file length after the close (temp_file.length())
- do a client.setDebug() before excutemethod
If this doesn't give an answer please send a complete servlet example that
gives the error.
Dirk
Miguel Carvalho wrote:
> I'm tring to put a file in a webdav folder in my project. For experience
> I read a file from disk. If I do it in a single project, in a test
> class, everithing goes well.
> But I wan't to do do it in a Servlet environment. Using ServletServer
> that comes with jBuilder with the same exact code I get an exception.
> I've tried also with Jrun, TomCat and the same happens.
>
> Code and Exception fallows:
>
> InputStream input_stream = new FileInputStream(path+"/"+name);
>
> ...
>
> File temp_file = new File(temp_files_path, filename);
> BufferedReader in = new BufferedReader(new
> InputStreamReader(input_stream));
>
> PrintWriter out = new PrintWriter(new BufferedWriter(new
> FileWriter(temp_file)));
> while (in.ready())
> out.write(in.read());
> in.close();
> out.flush();
> out.close();
> try {
> method.sendData(temp_file);
> client.executeMethod(method);
> temp_file.delete();
> }
> catch(Exception ex){ex.printStackTrace();}
> }
>
> This works fine standalone. But in servlet environment I get:
>
> java.net.SocketException: Connection aborted by peer: socket write error
> at java.net.SocketOutputStream.socketWrite(Native Method)
> at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
> at
> org.apache.commons.httpclient.RequestOutputStream.write(RequestOutputStr
> eam.java:281)
> at
> org.apache.commons.httpclient.methods.PutMethod.streamQuery(PutMethod.ja
> va:255)
> at
> org.apache.commons.httpclient.HttpClient.sendRequestBody(HttpClient.java
> :1012)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
> 07)
> ...
>
> I'm using Jakarta-Slide1.0.14 release in JDK1.3. . I've tried with
> Crimson.jar+jaxp.jar, and with Xerces.
>
> Please help me, it's the only problem I have now. My project it's
> finished and I need to solve this so I can graduate.
>
> THANKS IN ADVANCE,
>
> Regards
>
> Maik
>
> ----------------------------------------------------------
> Miguel Carvalho
> ----------------------------------------------------------
> Infopulse Portugal
> Praça dos Poveiros 56 2º Salas 4-8
> 4000 393 Porto
> Portugal
> Tel:+351 22 3389103
> Fax:+351 22 3389104
> http://www.infopulse.pt
> ----------------------------------------------------------
> The Netherlands: http://www.infopulse.nl
> Romania: http://www.infopulse.ro
> ----------------------------------------------------------
> icq: 48259534
> odigo: 1464770
> yahoo_id : maik_pt
> ----------------------------------------------------------
>
> ----------------------------------------------------------
> Miguel Carvalho
> ----------------------------------------------------------
> Infopulse Portugal
> Praça dos Poveiros 56 2º Salas 4-8
> 4000 393 Porto
> Portugal
> Tel:+351 22 3389103
> Fax:+351 22 3389104
> http://www.infopulse.pt
> ----------------------------------------------------------
> The Netherlands: http://www.infopulse.nl
> Romania: http://www.infopulse.ro
> ----------------------------------------------------------
> icq: 48259534
> odigo: 1464770
> yahoo_id : maik_pt
> ----------------------------------------------------------