Bug 64849 - Embedded EL module descriptor missing uses and provides clauses
Summary: Embedded EL module descriptor missing uses and provides clauses
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: EL (show other bugs)
Version: 9.0.39
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2020-10-26 16:12 UTC by Rob
Modified: 2020-11-06 12:02 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Rob 2020-10-26 16:12:35 UTC
Tomcat Embedded EL has a bug closely related to one reported and fixed to the core module, issue 64751 "Incomplete module info descriptor". This is the stacktrace:

java.util.ServiceConfigurationError: javax.el.ExpressionFactory: module org.apache.tomcat.embed.el does not declare `uses`
[ERROR] 	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
[ERROR] 	at java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:574)
[ERROR] 	at java.base/java.util.ServiceLoader.<init>(ServiceLoader.java:503)
[ERROR] 	at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1646)
[ERROR] 	at org.apache.tomcat.embed.el@9.0.39/javax.el.ExpressionFactory.getClassNameServices(ExpressionFactory.java:372)
[ERROR] 	at org.apache.tomcat.embed.el@9.0.39/javax.el.ExpressionFactory.discoverClassName(ExpressionFactory.java:330)
[ERROR] 	at org.apache.tomcat.embed.el@9.0.39/javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:134)
[ERROR] 	at org.apache.tomcat.embed.el@9.0.39/javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:86)

Looking at module-info.java and the contents of META-INF/services I think there are two missing lines for this module descriptor; not just the uses clause, but also and the provides clauses. Both of these lines need adding:

uses javax.el.ExpressionFactory;
provides javax.el.ExpressionFactory with org.apache.el.ExpressionFactoryImpl;

Both lines are necessary to recreate the service provider / loader mechanism with the module system; ExpressionFactory has static methods to look up the implementation (as part of the public newInstance method), so the module uses its own provided implementation.
Comment 1 Mark Thomas 2020-10-27 18:02:54 UTC
The first thing we are going to need to do is fix the JPMS names so they agree with the names used by the spec APIs.
Comment 2 Mark Thomas 2020-11-06 12:02:47 UTC
Thanks for the report. This highlighted a number of additional issues which have all been fixed.

Fixed in:
- 10.0.x for 10.0.0-M10 onwards
- 9.0.x for 9.0.40 onwards