You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stanley_Lee <ma...@yahoo.com> on 2006/05/06 00:19:03 UTC

Tomcat hang when call HttpURLConnection.connect() in init()

I try to detect another web application's accessibility in Servlet's init()
method: 
URL url = new URL("http://localhost:8080/xyz");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();

When application "xyz" is NOT available, above code:
- runs fine in standalone Java application (return File-not-found exception)
- runs fine if deploy to a running Tomcat

but it will hang Tomcat startup if it is in /web-apps while Tomcat restart.
I have to manually kill Tomcat process, then log will show ConnectException.
Looks like Tomcat is waiting on that connect() call.

Is there any work-around or better way to detect app's availability?

Thanks for any suggestion!

Stanley
--
View this message in context: http://www.nabble.com/Tomcat-hang-when-call-HttpURLConnection.connect%28%29-in-init%28%29-t1566864.html#a4255448
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org