This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Performance and the fly likes Tomcat HttpClient POST problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Tomcat HttpClient POST problem" Watch "Tomcat HttpClient POST problem" New topic
Author

Tomcat HttpClient POST problem

alex ene
Greenhorn

Joined: Jun 09, 2009
Posts: 2
Hi all,

I've got a very weird problem...
I am using: Apache Tomcat 5.5, Java 1.5.0, HttpClient (commons-httpclient-3.1.jar).
We have a huge platform that is loaded with the Tomcat Server. But something weird is going on...
Basically when we are trying to send an XML petition via a PostMethod using our platform which creates a
new thread for each job, an connection timeout error occurs, but we are trying to send it by using a simple
thread with a PostMethod, it all works very well.
The two petitions are IDENTICAL - including java code, but it seems that in the case of our platform, the response of the
.executeMethod() is getting very late and with an error.

I wonder which may be the causes for this delay?
More than that, with an older version of our software, everything goes smooth, the code is identical with the one of the
current version, but still there is a difference of how the PostMethod petition is executed. The commons-httpclient.jar
are identical. There are no other jars in the commons of tomcat or in any other classpath folder.

Anybody got any idea about what is going wrong?

Thanks in advance!
Michael Schlegel
Greenhorn

Joined: Sep 11, 2009
Posts: 13
Hi,

I don't know exactly from where comes your problem, but one question:
Do you use MultiThreadedHttpConnectionManager to handle http connections inside HttpClient?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15947
    
  19

Do I understand correctly that you're saying that single POSTs work OK, but when you flood the Tomcat server with multiple POST threads, it's a problem?

If so, yes it is. Tomcat has a fixed-size thread pool. When more requests come in than there are threads in the pool, the extra requests are going to suffer.


Customer surveys are for companies who didn't pay proper attention to begin with.
alex ene
Greenhorn

Joined: Jun 09, 2009
Posts: 2
SOLVED.
The problem was in fact that the application was executing POST-s via a .jar file of some free GIS -type API.
And that POST method was using some native java classes to send the POST-s.
I had to replace the class from the jar, overwriting it with the same class but I had to change the code
that was sending the POST-s with a code that was sending them using the Apache httpclient library.
It seems that the java native way of sending POST-s was working with a delay, but, using the
httpclient it worked perfectly.
 
 
subject: Tomcat HttpClient POST problem
 
Similar Threads
SSLHandshake Error while connection to remote server
Http timeout java 1.4.2
prob with Jakarta HttpClient & HostConfiguration
Problem using HttpClient MultipartRequestEntity in Tomcat over Solaris
sun.net.www.http.httpclient