HDDS-8280. Upgrade Jetty 9.4 to 12 (Jakarta EE10) - #11201
Open
yandrey321 wants to merge 11 commits into
Open
Conversation
# Conflicts: # hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectAttributesGet.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Approach
The bulk of the diff is mechanical:
javax.servlet→jakarta.servlet,javax.ws.rs→jakarta.ws.rs,javax.annotation.{PostConstruct,PreDestroy,Priority}→
jakarta.*,org.eclipse.jetty.servlet.*→org.eclipse.jetty.ee10.servlet.*, and theversion matrix in the root pom (Jetty
12.0.38, Jersey3.1.12,jakarta.ws.rs-api3.1.0,jakarta.servlet-api6.0.0, Weld5.1.7, Guice7.0.0, CDI-api4.0.1). TransitiveJetty 9 is excluded from the hadoop-common/hdfs dependencies so only Jetty 12 is on the
server classpath.
The rest of this description covers the non-mechanical parts — the places where a
straight rename was not sufficient.
1. javax↔jakarta servlet bridge for hadoop's auth filters (central design choice)
hadoop-common stays on
javax.servlet/ Jetty 9 upstream, but Ozone's SPNEGO / Kerberos /delegation-token authentication is provided by hadoop's
javax.servlet.Filterimplementations. Rather than fork that authentication chain, a minimal bridge
(
hadoop-hdds/framework/.../server/http/servletbridge/) wraps a javax filter as a jakartaFilter(JavaxFilterBridge), presents jakarta request/response as javax views to thedelegate, and overlays the authenticated principal (remote user, user principal, auth type,
roles) back onto the jakarta request for the downstream chain.
ServletElementsFactoryis the single wiring point (
holder.setFilter(new JavaxFilterBridge(...))). This keepshadoop's auth code as the source of truth while the HTTP stack runs on jakarta, and is why
both
javax.servlet-api(3.1.0) andjakarta.servlet-api(6.0.0) are kept on the classpath(different packages, so they coexist).
2. Forked
JMXJsonServletinto Ozone (jakarta)hadoop-common's
JMXJsonServletis javax-based and cannot be registered on a jakartaServletContextHandler, so it is forked intohadoop-hdds/framework/.../server/http/JMXJsonServlet.javaas a jakarta servlet withidentical behavior. (Ozone already forks
HttpServer2/HddsConfServlet, so this followsthe existing pattern.)
3.
HttpServer2structural rewrite for removed/changed Jetty 12 APIsHandlerCollection(removed) →Handler.Sequence+ContextHandlerCollection.RequestLogHandler(removed) →CustomRequestLogset directly on theServer.org.eclipse.jetty.util.ArrayUtil(removed) →java.util.Arrays.MultiException(removed) →ExceptionUtil.MultiException.refuses to start when it does not exist (Jetty 9 tolerated it). The shared
/staticassetsare unpacked into each module's
webapps/directory at package time, so they are presentin the packaged jar/dist but absent during the unit-test phase. Both default contexts are
guarded:
/logscreates its directory, and/staticis served only when its base resourceexists. This preserves production behavior while letting OM/SCM HTTP-server unit tests start.
4.
S3ContentTypeFilter— keep the bareapplication/xmlcontent-typeAWS S3 (and Ozone pre-upgrade) return
application/xmlwith no charset. On Jetty 12 theresponse tracks a character encoding that, once promoted from
NOT_SETinternally, causesJetty to rebuild the header as
application/xml;charset=utf-8even when a bare value was set.The new filter resets the tracked encoding to
NOT_SETright before writing anapplication/xmlcontent-type, so S3 clients continue to see the bare value they expect.5. CDI 4 / Weld 5 bean discovery (s3gateway)
CDI 4's default
bean-discovery-modechanged fromalltoannotated, which caused Weld 5to skip beans like
OzoneClientCachethat were previously discovered. The s3gatewaybeans.xmlfiles are set toversion="4.0" bean-discovery-mode="all"to preserve discovery.6. JAX-RS / DI container wiring
web.xmldescriptors bumped to Servlet 6.0 (jakarta namespace,https://jakarta.ee/xml/ns/jakartaee,web-app_6_0.xsd) withjakarta.ws.rs.Applicationinit-params (recon, s3gateway, httpfsgateway).
jakartaGuiceFilter).jakarta.xml.bind-api4.0.x dropped an API Recon relied on at runtime;this surfaced only in the assembled distribution as
jakarta.xml.bind.PropertyException.The JAXB dependency is aligned so the runtime resolves against jakarta 4.0.x.
7. Stricter default URI compliance (S3 proxy test harness)
Jetty 12's default URI compliance rejects
//and percent-encoded characters that appear inS3 object keys. The S3 integration-test
ProxyServersetsUriCompliance.LEGACYand enablessetDecodeAmbiguousURIs(true)so such keys are forwarded rather than 400-rejected, matchingthe S3 Gateway's own lenient handling.
Generated-by: Claude Code (claude-opus-4-8)
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8280
How was this patch tested?
CI: https://github.com/yandrey321/ozone/actions/runs/33823459774/job/100873964388
Unit, integration, robot tests.