我在测试环境中的 Websphere 上托管了简单的 Spring J2EE Web 应用程序。我们有一些存储过程,有时需要超过 1 分钟。在这种情况下,服务器在触发 ajax 调用时返回500 Internal server error page
。如果总响应时间少于 1 分钟,则效果很好。
当我们在本地 Tomcat 服务器上运行相同的应用程序时,即使我们的代码花费了超过 2 分钟,它也不会抛出 500,而是返回响应。但在 Websphere 服务器上失败。
我已经通过在本地的Tomcat服务器和测试环境的Websphere服务器中添加 sleep 进行了测试,但在测试环境中失败了。 websphere 上似乎有一些超时设置。
我还尝试在应用程序服务器下的 Web 容器设置中添加以下自定义属性:
- 连接空闲超时 (300)
- ConnectionIOTimeOut(300)
- 连接保持事件超时
下面是我得到的html内容:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">↵<html><head>↵<title>500 Internal Server Error</title>↵</head><body>↵<h1>Internal Server Error</h1>↵<p>The server encountered an internal error or↵misconfiguration and was unable to complete↵your request.</p>↵<p>Please contact the server administrator,↵ <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0871677d4871677d7a26696c6c7a6d7b7b" rel="noreferrer noopener nofollow">[email protected]</a> and inform them of the time the error occurred,↵and anything you might have done that may have↵caused the error.</p>↵<p>More information about this error may be available↵in the server error log.</p>↵</body></html>
最佳答案
这个问题可以通过增加plugin-cfg.xml中的ServerIOTimeout来解决。
ServerIOTimeout 的意思是“插件应该等待应用程序响应多长时间”(以秒为单位)。套接字打开后,插件将请求发送到应用程序服务器。在 Websphere 7 中,其默认值为 60,在某些情况下该值非常小。 重要的一点是,一旦您编辑了plugin-cfg.xml。您需要重新生成插件才能使更改生效。另一件事是,即使您在管理控制台中更改它,它也会从 plugin-cfg.xml 中读取它(如果存在),因此始终直接更改 xml 文件。
此文件的位置:-
详情请参阅IBM DOCS和 this really good blog .
关于timeout - 如果 Java 进程在 Websphere 上运行超过 1 分钟,应用程序将响应 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32304850/