Skip to content

fix(jetty12): throw fatal exception on missing or unavailable servlets during startup (#103)#517

Open
ludoch wants to merge 2 commits into
mainfrom
fix/issue-103
Open

fix(jetty12): throw fatal exception on missing or unavailable servlets during startup (#103)#517
ludoch wants to merge 2 commits into
mainfrom
fix/issue-103

Conversation

@ludoch

@ludoch ludoch commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Fixes #103 across all Jetty 12 and Jetty 12.1 runtime and local dev modules (runtime_impl_jetty12, runtime_impl_jetty121, local_jetty121, and local_jetty121_ee11).

Problem

Previously, when a web application defined a nonexistent servlet class or encountered a startup initialization error (ClassNotFoundException / UnavailableException in web.xml), Jetty 12 caught the exception and logged it as a WARNING during WebAppContext.doStart(). The application context would start up without failing, and only return HTTP 503 at runtime when requests hit the missing servlet.

Solution

  1. Disallow Starting with Unavailable Servlets:
    In AppEngineWebAppContext.newServletHandler(), explicitly configured handler.setStartWithUnavailable(false) across all Jetty 12 / 12.1 contexts (ee8, ee10, ee11).
  2. Explicit Startup Verification:
    Added strict inspection in AppEngineWebAppContext.doStart() after super.doStart(). If any registered ServletHolder or the context itself has caught an UnavailableException / initialization error (holder.getUnavailableException() != null), doStart() re-throws it (IllegalStateException / ServletException) causing application startup to fail immediately and fatally.
  3. Unit Tests:
    Added unit tests (missingServletClassThrowsOnStartupEe8, missingServletClassThrowsOnStartupEe10, missingServletClassThrowsOnStartupEe11) in AppEngineWebAppContextTest across runtime_impl_jetty12 and runtime_impl_jetty121 verifying that deploying an application with a missing servlet class throws an exception during doStart().

Testing

All unit test suites across runtime_impl_jetty12, runtime_impl_jetty121, local_jetty121, and local_jetty121_ee11 pass cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when loading a Web App with missing servlet class defined in web.xml is not reported as fatal

1 participant