eclipse 有时 java.net.SocketTimeoutException: 读取超时。有时不

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16788078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:37:49  来源:igfitidea点击:

Sometimes java.net.SocketTimeoutException: Read timed out. Sometimes not

javaeclipsetomcat7timeoutexception

提问by Bender

I have this strange error with the

我有这个奇怪的错误

java.net.SocketTimeoutException: Read timed out

And maybe someone of you can help to fix this problem.

也许你们中的某个人可以帮助解决这个问题。

The facts are these, I'm working with Eclipse, with a Tomcat v7. Then I execute a function which have

事实是这些,我正在使用EclipseTomcat v7。然后我执行一个函数

_call.setTimeout(3500);

In my Windows->Preferences->Java->DebugI have

在我的Windows->Preferences->Java->Debug我有

Debugger timeout(ms):3000
Launch timeout(ms):20000

In my Servers->Tomcat v7.0->TimeoutsI have

在我的Servers->Tomcat v7.0->Timeouts我有

Start(in seconds): 45
Stop(in seconds): 15

Now, when I run my WebService, sometimes it works perfect, sometimes I get the RemoteException e2: java.net.SocketTimeoutException:Read timed out

现在,当我运行我的 WebService 时,有时它运行良好,有时RemoteException e2: java.net.SocketTimeoutException:读取超时

Did I set the Timeoutcorrectly? Because I tried to change it and stills happens the same, sometimes gets the error, sometimes not.

我设置Timeout正确了吗?因为我试图改变它并且仍然发生同样的情况,有时会出错,有时不会

回答by Old Pro

Apparently, sometimes the call you are making takes longer than 3.5 seconds to complete. In that case, getting a SocketTimeoutExceptionis the expected behavior.

显然,有时您拨打的电话需要超过 3.5 秒才能完成。在这种情况下,获得 aSocketTimeoutException是预期的行为。