Bug 65362 - Missing uses-Directives in JPMS descriptor of tomcat-embed-websocket.jar
Summary: Missing uses-Directives in JPMS descriptor of tomcat-embed-websocket.jar
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Packaging (show other bugs)
Version: 9.0.46
Hardware: All All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2021-06-07 10:39 UTC by Michael Kainer
Modified: 2021-06-07 17:59 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kainer 2021-06-07 10:39:01 UTC
The module-info.class of tomcat-embed-websocket.jar is missing the following two uses directives to be able to be used in a project that enables the JPMS.

uses javax.websocket.ContainerProvider;
uses javax.websocket.server.ServerEndpointConfig.Configurator;

The first one is required because javax.websocket.ContainerProvider#getWebSocketContainer() calls ServiceLoader.load(ContainerProvider.class).

The second one is required because javax.websocket.server.ServerEndpointConfig.Configurator#loadDefault() calls ServiceLoader.load(ServerEndpointConfig.Configurator.class).

Both calls fail with a ServiceConfigurationError if the uses directives are missing. I managed to fix this issue locally by patching the JAR in such a way, that both uses directives are included.

This bug is analogous to #64751.

I believe (but did not verify) that the same bug occurs in Tomcat 10 as well.
Comment 1 Mark Thomas 2021-06-07 16:50:49 UTC
This looks a side-effect of removing the BND annotations from the API classes because they broke the TCK (arguably the TCK should have ignored them but the TCK team disagreed).

The fix should - hopefully - be as simple as adding the same manual entries to the embed JARs.
Comment 2 Mark Thomas 2021-06-07 17:59:49 UTC
Fixed in:
- 10.1.x for 10.1.0-M1 onwards
- 10.0.x for 10.0.7 onwards
- 9.0.x for 9.0.47 onwards

8.5.x does not include JPMS metadata