TOMEE-4643 - discover Feature/DynamicFeature from META-INF/services - #2877
TOMEE-4643 - discover Feature/DynamicFeature from META-INF/services#2877jungm wants to merge 1 commit into
Conversation
Jakarta REST requires Feature and DynamicFeature implementations declared in META-INF/services to be registered via the JDK ServiceLoader at deploy time. CXF does not implement this lookup itself, relying on the container to hand it already resolved providers, so features packaged this way never registered in TomEE. Scan for both SPIs while assembling the provider list. Service loading is skipped when the Application maps jakarta.ws.rs.loadServices to Boolean.FALSE, as the spec requires, and honours the existing skip-provider-scanning property. Entries are loaded individually so one broken descriptor entry does not discard the remaining providers of that type. Removes the corresponding TCK exclusion, which now passes.
|
@jungm Can you check on ee.jakarta.tck.ws.rs.jaxrs21.ee.sse.ssebroadcaster.JAXRSClientIT.sseBroadcastTest ? Is this a regression? |
|
@rzo1 think its flaky but will check |
|
its flaky, sseBroadcastTest starts 5 SSE clients on threads, waits a fixed 2.5s for them to connect, broadcasts 7 messages, then waits only on the first client before asserting all 5 received exactly 8 events. Clients could not be connecting in time or still be processing evens on a crowded machine Also seems to have failed in other runs I did here and there |
|
Currently short on time, so AI review only: I ran an adversarial review pass over this PR, followed by a second pass whose job was to refute the first one's findings against the actual code. Everything below survived that second pass. Take it as input, not as a verdict — I have not run the build. Overall: the mechanism looks sound. 1.
|
Jakarta REST requires
FeatureandDynamicFeatureimplementations declared inMETA-INF/servicesto be registered through the JDKServiceLoaderat deploy time ("Services", Providers / Lifecycle and Environment).CXF does not implement this lookup itself — it relies on the container to hand it already resolved providers, which is why the CXF TCK run stays green on GlassFish. TomEE assembles its provider list on its own, so features packaged this way never registered.
Changes
CxfRsHttpListenerscans both SPIs while assembling the provider list.Applicationmapsjakarta.ws.rs.loadServicestoBoolean.FALSE, as the spec mandates, and the existingcxf.jaxrs.skip-provider-scanningproperty is still honoured.providers(...)path, so the@ConstrainedToand deactivation checks still apply.jaxrs31/spec/extensions/JAXRSClientIT.Testing
ServiceLoaderProviderDiscoveryTest(8 tests) exercises discovery through a throwawayURLClassLoader, so it does not register these features into other tests in the module. Each assertion was confirmed to fail when the corresponding production change is reverted.ee.jakarta.tck.ws.rs.jaxrs31.spec.extensions.JAXRSClientITpasses 2/2 unexcluded against a rebuilt TomEE plus distribution; the widerjaxrs31.**slice passes 4/4.openejb-cxf-rssuite: 123 tests, the only failure beingEJBExceptionMapperTest.security, which fails identically on a clean checkout ofmain.🤖 Generated with Claude Code