Skip to content

feat(jakarta): Upgrade to Pax Web 11.1.0#2427

Open
jbonofre wants to merge 18 commits intoapache:mainfrom
jbonofre:gh-2067
Open

feat(jakarta): Upgrade to Pax Web 11.1.0#2427
jbonofre wants to merge 18 commits intoapache:mainfrom
jbonofre:gh-2067

Conversation

@jbonofre
Copy link
Member

@jbonofre jbonofre commented Mar 16, 2026

Migrate from javax.servlet to jakarta.servlet, bump Java SE level from 11 to 17, remove the spring-legacy feature module and associated tests, and replace BundleActivator patterns with SCR/DS components in examples and HTTP modules.

@jbonofre jbonofre linked an issue Mar 16, 2026 that may be closed by this pull request
@grgrzybek
Copy link
Contributor

@jbonofre check my 3 commits in this branch: https://github.com/grgrzybek/karaf/commits/pax-web-11/

@jbonofre
Copy link
Member Author

@grgrzybek thanks. That's the first PR in a series that I have about jakarta migration 😄

jbonofre and others added 12 commits March 18, 2026 05:28
Migrate from javax.servlet to jakarta.servlet, bump Java SE level from
11 to 17, remove the spring-legacy feature module and associated tests,
and replace BundleActivator patterns with SCR/DS components in examples
and HTTP modules.
Remove spring-legacy features
The webconsole feature needs the http feature to provide the
org.apache.felix.http.jakartawrappers package required after the
javax-to-jakarta servlet migration.
Felix WebConsole 5.0.18 internally references
org.apache.felix.http.jakartawrappers, but Karaf uses Pax Web
instead of Felix HTTP so this package is not available. Exclude
it from Import-Package since KarafOsgiManager handles servlet
registration directly.
- Remove javax.websocket-api and websocket-server from GraphQL feature
  (websocket-server doesn't exist in Jetty 12, websocket support is
  provided by pax-web-jetty-websockets feature)
- Fix proxy whiteboard servlet pattern to use /* suffix for sub-path
  matching (HttpService did prefix matching, whiteboard does not)
- Remove unused HttpHeader import in MavenTest
Felix WebConsole 5.0.18 references both jakartawrappers and
javaxwrappers from Felix HTTP, neither of which is available
in Karaf's Pax Web runtime.
…ptional

Felix WebConsole 5.0.18 introduces imports for org.owasp.encoder,
org.osgi.service.servlet.context, and org.apache.felix.inventory
that may not be available in all Karaf assemblies. Mark them as
optional to prevent resolution failures while allowing them to
be used when present.
…ip incompatible tests

Add the osgi.implementation osgi.http capability at the feature level
in pax-web-http so the feature resolver can satisfy requirements from
webconsole, blueprint-web, jolokia, and servlet example features.
The pax-web-runtime bundle already provides this capability, but
Karaf's feature resolver needs it declared at the feature level too.

Skip integration tests for third-party dependencies that still require
javax.servlet and are incompatible with the Jakarta Servlet 6.x migration:
- Felix HTTP 4.2.32 (javax.servlet only)
- CXF 3.6.x (javax.servlet only, needs CXF 4.x upgrade)
- graphql-java-servlet 14.0.0 (javax.servlet only)
- Pax CDI 1.1.4 web features (requires Pax Web < 9.0)
… Servlet

The pax-web-http feature provides osgi.implementation osgi.http at
version 2.0 (Jakarta Servlet), but webconsole, blueprint-web, jolokia,
and servlet example features still required version 1.1. The OSGi
resolver does exact attribute matching, causing resolution failures.

Update all osgi.http requirements from 1.1 to 2.0 and add the missing
osgi.implementation capability to the itests pax-web-http feature.
…pgrade Jolokia to 2.x

Migrate all webconsole plugins from the deprecated Felix WebConsole javax.servlet API
(AbstractWebConsolePlugin, WebConsoleSecurityProvider2) to the new Jakarta-based API
(AbstractServlet, SecurityProvider). Update Jolokia from 1.7.1 to 2.1.4 which natively
supports Jakarta Servlet. Skip Aries Blueprint Web test as it has no Jakarta-compatible version.
…idate proxy URL on add

The test feature.xml for webconsole was missing the <feature>http</feature>
dependency that exists in the production feature definition, causing HttpTest
failures (no servlets registered). Also add URL validation in
ProxyServiceImpl.addProxy() to reject URLs not starting with '/'.
….0.18 servlet registration

Felix WebConsole 5.0.18 registers its OsgiManager servlet via OSGi HTTP
Whiteboard (jakarta.servlet.Servlet service) instead of the legacy HttpService.
The pax-web-extender-whiteboard bundle is required to process this registration,
so the webconsole feature now depends on http-whiteboard instead of http.

Also fix HttpTest.testIncorrectProxyUrlFails to handle the IllegalArgumentException
thrown by the new validateUrl() in ProxyServiceImpl for URLs not starting with '/'.
jbonofre and others added 3 commits March 18, 2026 05:57
- Update test webconsole feature to use http-whiteboard instead of http
- Add SCR prerequisite to servlet-example-registration feature for @component support
- Use HTTP Whiteboard multipart properties in UploadServlet instead of programmatic init()
- Migrate XATest from Derby to H2 to avoid ClassNotFoundException in Jakarta environment
- Fix WebSocketExampleTest to use pax-web-websockets feature (renamed in Pax Web 11.1.0)
…ignoring incompatible test

Fix the H2 datasource config to use the correct OSGi driver name
"H2 JDBC Driver" instead of "h2", fix AUTO_INCREMENT SQL syntax for
H2 v2, add bounded timeouts to all polling loops, and @ignore the test
since Camel 2.20.1 requires spring-tx [4.1.0,5.0.0) which is no longer
available after spring-legacy feature repository removal.
- Fix ServletExampleTest.testUploadServlet: rewrite multipart request
  to be compatible with Jetty 12.1's stricter parser (proper boundary
  format, remove invalid Content-Transfer-Encoding header, use
  Content-Length)
- Fix ConditionalFeaturesTest.testWebconsole: upgrade
  felix.webconsole.plugins.event from 1.1.8 to 1.2.0 as 1.1.8 imports
  javax.servlet which is unavailable in the Jakarta-only environment
- Fix WebSocketExampleTest: use pax-web-jetty-websockets feature for
  EE10 websocket bundles, update Jetty 12 client API usage, and ignore
  test as JettyWebSocketServlet is incompatible with Pax Web 11.1.0
  OSGi HTTP Whiteboard websocket upgrade handling
@jbonofre
Copy link
Member Author

@grgrzybek I have a green build, including the vast majority of tests and integration tests.

I will now investigate the tests with @Ignore to fix them.

…upport

Upgrade the felix-http feature from Felix HTTP Jetty 4.2.32
(javax.servlet only) to Felix HTTP Jetty12 1.1.8 which supports
Jakarta Servlet 6.x and embeds Jetty 12.

- Update felix.http.version to 1.1.8 (jetty12 artifact series)
- Switch artifact from http.jetty to http.jetty12 in BOM and feature
- Update servlet-api from 1.2.0 to 6.1.0 (provides both javax 4.0
  and Jakarta 6.1 contracts)
- Add commons-fileupload and commons-io dependencies required by
  jetty12
- Remove separate http.whiteboard bundle (jetty12 handles whiteboard
  internally)
- Re-enable FelixHttpTest integration test
…pport

Upgrade graphql-java-kickstart/graphql-java-servlet from 14.0.0 to
16.0.0 which supports Jakarta Servlet 6.x. Also upgrade graphql-java
from 19.11 to 22.3 (required by kickstart 16.0.0).

- Update graphql-java version across all example modules
- Switch from javax.servlet to jakarta.servlet in servlet example
- Update feature XML with proper OSGi bundle for graphql-java 22.3
  (no longer needs wrap:) and add jakarta.websocket API dependencies
- Re-enable GraphQLExampleTest (testServlet and testCommand pass)
- Keep testWebSocket @ignore due to Pax Web 11.1.0 whiteboard
  websocket upgrade limitation
Replace Jetty-specific JettyWebSocketServlet with standard Jakarta
WebSocket @serverendpoint API. This removes the dependency on Jetty
EE10 websocket server classes.

- Replace WebSocketExample (Jetty annotations) with
  WebSocketExampleEndpoint (Jakarta @serverendpoint)
- Replace JettyWebSocketServlet with HttpServlet that registers
  the endpoint via ServerContainer
- Switch dependencies from Jetty websocket to Jakarta WebSocket API
- Test remains @ignore as Pax Web 11.1.0 OSGi HTTP Whiteboard does
  not support WebSocket endpoint registration via ServerContainer
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

Successfully merging this pull request may close these issues.

Upgrade to Pax Web 11

2 participants