Skip deploying or stop web application if servlet context initialization fails

Alex Salauyou :

In our project, we have several Spring-based modules which are deployed on WAS as web applications. We need to skip deployment, or stop a module if its Spring context initialization fails (i.e. ContextLoaderListener#contextInitialized or DispatcherServlet#init throws an exception). Now, if such happens, app is got deployed and starts, but returns HTTP 500 for any request.

Websphere 8.5.5

Related question: https://stackoverflow.com/a/272747/3459206

Thomas Bitonti :

This APAR seems to be relevant:

https://www-01.ibm.com/support/docview.wss?uid=swg1PI58875

From the APAR text:

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.

Problem conclusion

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

See the APAR link for additional information.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=101974&siteId=1