0

I have a web application and I have problem with request timeout. Problem is in request timeout. When I start my application locally my method needs more than 30 seconds to finish its job. Because of this after 30 seconds request will be cancelled. I haven't this problem in real server. It real server this request needs 3 seconds. I tried to increase connection timeout in server.xml in tomcat conf folder in this fragment <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/> , but this didn't solve my problem

G.Ch.
  • 35
  • 6
  • so your job at server start up takes more than 30 seconds and tomcat is shutting down because your job is pending for too long ? – Arkantos Feb 23 '15 at 17:41
  • are you facing this issue in some IDE or standalone tomcat instance? – Mahendra Feb 23 '15 at 17:43
  • @Arkantos there is not problem in server starting. I start server without any problem, but when I called one concrete method it needed more than 30 seconds and after 30 seconds this request cancelled – G.Ch. Feb 23 '15 at 18:17
  • @Mahendra Yes, I faced this problem in eclipse – G.Ch. Feb 23 '15 at 18:17
  • is it a db request that is taking more than 30 secs or some web service request ? – Arkantos Feb 23 '15 at 18:18
  • This request gets data from db, but I faced this problem only on local machine, on real server this methods needs 3 seconds – G.Ch. Feb 23 '15 at 18:21
  • If it's a simple `statement` that you're executing using JDBC, then you can set timeout on statement object itself before firing query like `java.sql.Statement.setQueryTimeout(40)` as 40 seconds – Arkantos Feb 23 '15 at 18:32
  • I am using JPA, so can I make same for query ? – G.Ch. Feb 23 '15 at 18:38
  • Which provider are using for JPA ? Hibernate or something else ? – Arkantos Feb 23 '15 at 18:41
  • See [this](http://stackoverflow.com/questions/13011829/jpa-query-timeout) and [this](http://stackoverflow.com/questions/24244621/set-timeout-on-entitymanager-query) – Arkantos Feb 23 '15 at 18:43

1 Answers1

0

To increase Tomcat server timeout in Eclipse, go to server view tab then timeouts. There specify start and stop timeout limits, applicable if your server is not starting.

If server is running fine and specific request is taking more time, then check your method, if some DB or webservice operation is taking more than expected time, which might be the cause of delay and ultimately request timeout.

Mahendra
  • 323
  • 1
  • 7
  • @Mahenda the method needs more than 30 seconds on local machine, but on real server it needs 3 seconds, so problem is not in method's logic – G.Ch. Feb 24 '15 at 06:01
  • if you can tell us what exactly you are doing in that Method, it will be better to understand. – Mahendra Feb 24 '15 at 08:57
  • I only making search request (select). Today method worked locally, it needed less than 30 seconds. Can it be problem with logs ? If there is too many logs – G.Ch. Feb 25 '15 at 08:22
  • Yes, excessive logging may also be issue, it write logs to FileSystem. is logging level same on local and Production server. – Mahendra Feb 27 '15 at 04:11