Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPProvider.bootlift catch UnavailableException but should not #1843

Closed
fanf opened this issue Apr 26, 2017 · 1 comment
Closed

HTTPProvider.bootlift catch UnavailableException but should not #1843

fanf opened this issue Apr 26, 2017 · 1 comment
Assignees
Milestone

Comments

@fanf
Copy link

fanf commented Apr 26, 2017

Mailing List thread: https://groups.google.com/forum/#!topic/liftweb/BHYjE5C-kIk

The HTTPProvider.bootLift method is catching javax.servlet.UnavailableException, which it should not because the exception is here to tell the application server that the servlet failed to boot.

In Lift 2.6.x, it was even worse because the method was catching ALL exceptions, even Errors.

How to reproduce
Throws a javax.servlet.UnavailableException in Lift boot() method. The exception is caught during boot and the log displays a big warning message:

------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------
******** Failed to Boot! Your application may not run properly
[here the exception message]
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------------

Use case
I'm doing a lot of initialization and resource availability checking at bootstrap, and it was natural to put them in Lift boot() method. The UnavailableException was a conventionnal way to tell the web-app server that something went horribly wrong during init and the servlet is unavailable. Jetty (for ex) will then respond with "error 503: service unavailable" when a query is done to that app.

Workaround
For now, I added a ServletContextListener where I'm doing the init and throw UnavailableException, but it splits the initialization logic between it and Lift boot() and make the code harder to follow.

@farmdawgnation farmdawgnation added this to the 3.1.0-M3 milestone Apr 26, 2017
@farmdawgnation farmdawgnation self-assigned this Apr 26, 2017
@farmdawgnation
Copy link
Member

Going to aim to handle this for 3.1.0-M3.

@Shadowfiend Shadowfiend modified the milestones: 3.1.0-M3, 3.1.0-RC1 May 20, 2017
farmdawgnation added a commit that referenced this issue Jun 11, 2017
This code adds special handling for javax.servelet.UnavailableException.
This exception is an idiomatic way to signal a full abort to the Java
Application server running the application.

Please see #1843 for more information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants