Socket connection timeout fter idle time
knatarajan Apr 26, 2005 1:25 PMHi all,
I am running JBOSS 4.0.1 on Windows. I have a client code within Jboss that connects to the same jboss server URL (this is part of CAS authentication).
All is well when Jboss starts up initially. But if I leave my Jboss server running overnight and try accessing it after a period of inactivity, I get a connection refused exception during socket connect. The server responds with the same URL from the browser window. My code snippet and exception log are given below.
I really appretiate your help on this ! Thanks !!
/************* CODE ***************/
URL u = new URL(url);
if (!u.getProtocol().equals("https"))
throw new IOException("only 'https' URLs are valid for this method");
URLConnection uc = u.openConnection();
uc.setRequestProperty("Connection", "close");
r = new BufferedReader(new InputStreamReader(uc.getInputStream()));
-------> The getInputStream() is from where the exception is thrown !!!
/*************** EXCEPTION LOGS *************/
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA6275)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.protocol.https.HttpsClient.(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
at edu.yale.its.tp.cas.util.SecureURL.retrieve(Unknown Source)
Thanks,
K