Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > commons httpclient - PutMethod run OutOfMemoryError ??

Reply
Thread Tools

commons httpclient - PutMethod run OutOfMemoryError ??

 
 
Bastian
Guest
Posts: n/a
 
      12-06-2005
hello,

when running the follwoing code, i get a error message from
SimpleHttpConnectionManager.releaseConnection:

WARNING: SimpleHttpConnectionManager being used incorrectly. Be sure
that HttpMethod.releaseConnection() ist always called and that only one
thread and/or method is this connection manager at a time.

And it throws java.lang.OutOfMemoryError

This happend only if try to upload bigger files (prob > 50MB) smaller
textfiles are no proplem with this code.


What can i do to solve that problem and what is the problem in detail?


thx
bastian


Code:

PutMethod method2 = null;
try {
method2 = new PutMethod(url+"/"+remote);
method2.setRequestEntity(
new InputStreamRequestEntity(

new FileInputStream( local ) ) );
} catch (FileNotFoundException e) {
log.warning("File doesnt exist: " + local);
e.printStackTrace();
return false;
}
long start = 0, time = 0, bytes = local.length();
try {
// Execute the method.
start = System.currentTimeMillis();
int statusCode =
httpclient.executeMethod(method2);
time = System.currentTimeMillis() - start;
if (statusCode != HttpStatus.SC_CREATED
&& statusCode !=
HttpStatus.SC_OK) {
log.warning("PutMethod failed: " +
method2.getStatusLine() + " Statuscode="+statusCode);
} else
ret = true;
} catch (HttpException e) {
log.severe("Fatal protocol violation: " +
e.getMessage());
e.printStackTrace();
} catch (IOException e) {
log.severe("Fatal transport error: " +
e.getMessage());
e.printStackTrace();
} finally {
// Release the connection.
method2.releaseConnection();
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Commons HttpClient 3.1 POST example? Sebastian Java 1 06-22-2011 08:29 AM
Jakarta Commons HttpClient and a socket reset Joe Linux Java 0 09-15-2006 02:53 PM
Serialize session state & OutOfMemoryError? =?Utf-8?B?RGF2ZQ==?= ASP .Net 2 09-08-2005 08:37 PM
how to set cipher-suite in commons httpclient the_caspie@hotmail.com Java 2 08-29-2005 12:26 PM
Importing Hotmail Addressbook from Java Client using commons-httpclient APIs Gamas Java 0 02-04-2005 11:50 PM



Advertisments