如果 java 在 Websphere 处理 运行 超过 1 分钟,应用程序将响应 500

Application is responding with 500 if java process run for more than 1 min at Websphere

我有一个简单的 Spring J2EE Web 应用程序应用程序托管在测试环境中的 Websphere 上。我们有一些存储过程,有时需要超过 1 分钟。在这种情况下,服务器在触发 ajax 调用时返回 500 Internal server error page。如果总响应时间少于 1 分钟,则可以正常工作。

当我们在本地 tomcat 服务器上 运行 相同的应用程序时,即使我们的代码花费超过 2 分钟,它也不会抛出 500,而是 returns 响应。但它在 Websphere 服务器上失败了。

我已经通过在测试环境中的本地和 Websphere 两台服务器 tomcat 中添加睡眠进行了测试,它在测试环境中失败了。 websphere 上似乎有一些超时设置。

我还尝试在应用程序服务器下的 Web 容器设置中添加以下自定义属性:

  1. ConnectionIdleTimeout (300)
  2. ConnectionIOTimeOut(300)
  3. ConnectionKeepAliveTimeout

以下是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,↵ you@your.address 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>

此问题已通过增加插件中的 ServerIOTimeout 得到解决-cfg.xml。

ServerIOTimeout 表示 "how long should the plug-in wait for a response from the application" 秒。套接字打开后,插件向应用服务器发送请求。它的默认值在 Websphere 7 中是 60,这在某些情况下非常小。 重要的一点是,一旦你编辑了 plugin-cfg.xml。您需要重新生成插件才能使更改生效。另一件事是,即使您在管理控制台中更改它,它也会从 plugin-cfg.xml 中读取它(如果它存在),因此请始终直接更改 xml 文件。

此文件的位置:-

详情请参考IBM DOCS and this really good blog