java - 如果 servlet 上下文初始化失败,则跳过部署或停止 Web 应用程序
问题描述
在我们的项目中,我们有几个基于 Spring 的模块作为 Web 应用程序部署在 WAS 上。ContextLoaderListener#contextInitialized
如果 Spring 上下文初始化失败(即或DispatcherServlet#init
抛出异常),我们需要跳过部署或停止模块。现在,如果发生这种情况,应用程序将被部署并启动,但对于任何请求都会返回 HTTP 500。
Websphere 8.5.5
解决方案
这个 APAR 似乎是相关的:
https://www-01.ibm.com/support/docview.wss?uid=swg1PI58875
从 APAR 文本:
Listener exceptions typically should not stop the application
from starting up for service. However, some applications depend
on their listeners to do the necessary setup before the
application is started for service. Such applications prefer to
stop the application from starting up when there is any
exception in their listeners.
问题结论
The WebContainer Container code was modified to provide an
option to stop the application when there is any listener
exception during the application starting up process.
A new WebContainer custom property needs to be set to enable the
behavior provided by this APAR:
For Full Profiles
com.ibm.ws.webcontainer.stopappstartuponlistenerexception = true
(default is false)
For Liberty Profile
stopappstartuponlistenerexception=true
The fix for this APAR is currently targeted for inclusion in
WebSphere Application Server fix packs 8.5.5.11 and 9.0.0.2,
and Liberty 16.0.0.3
有关其他信息,请参阅 APAR 链接。
推荐阅读
- ios - 使用 Alamofire 和 Swift 的 Realm
- postgresql - 如何使用列表作为 Vertx JDBC 客户端的 SQL 查询的参数源?
- c# - Xdocument 解析文件并读取值
- julia - 在向量的参数向量上调度时出现 MethodError
- r - 如何获得唯一 ID 的因子级别
- java - 一个类已由 Java 运行时的更新版本编译
- python - 如何修改python假期库中的观察值
- python - Python文件上传使用S3签名?
- python - 使用 Selenium 单击第二个 img
- excel - Excel / SharedStrings 的排序算法