java.net.SocketTimeoutException: Read timed out under Tomcat

前端 未结 5 1931
旧时难觅i
旧时难觅i 2020-12-05 09:07

I have a Tomcat based web application. I am intermittently getting the following exception,

Caused by: java.net.SocketTimeoutException: Read timed out
    at          


        
5条回答
  •  醉酒成梦
    2020-12-05 09:47

    Connection.Response resp = Jsoup.connect(url) //
                    .timeout(20000) //
                    .method(Connection.Method.GET) //
                    .execute();
    

    actually, the error occurs when you have slow internet so try to maximize the timeout time and then your code will definitely work as it works for me.

提交回复
热议问题