Bug 64751

Summary: Incomplete module info descriptor
Product: Tomcat 9 Reporter: Guy Veraghtert <guy.veraghtert>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 9.0.38   
Target Milestone: -----   
Hardware: PC   
OS: Mac OS X 10.1   

Description Guy Veraghtert 2020-09-18 10:23:33 UTC
Since version 9.0.38 tomcat-embedded-core is no longer usable in a jpms module context. Following exception occurs at startup:

Caused by: java.util.ServiceConfigurationError: org.apache.juli.logging.Log: module org.apache.tomcat.embed.core does not declare `uses`
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588) ~[na:na]
	at java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:574) ~[na:na]
	at java.base/java.util.ServiceLoader.<init>(ServiceLoader.java:503) ~[na:na]
	at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1691) ~[na:na]
	at org.apache.tomcat.embed.core@9.0.38/org.apache.juli.logging.LogFactory.<init>(LogFactory.java:89) ~[tomcat-embed-core-9.0.38.jar:na]
	at org.apache.tomcat.embed.core@9.0.38/org.apache.juli.logging.LogFactory.<clinit>(LogFactory.java:66) ~[tomcat-embed-core-9.0.38.jar:na]
	at org.apache.tomcat.embed.core@9.0.38/org.apache.catalina.core.AprLifecycleListener.<clinit>(AprLifecycleListener.java:48) ~[tomcat-embed-core-9.0.38.jar:na]
	at spring.boot@2.3.4.RELEASE/org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getDefaultLifecycleListeners(TomcatServletWebServerFactory.java:167) ~[spring-boot-2.3.4.RELEASE.jar:na]


The ServiceLoader API is used, but this is not correctly declared in the module-info.java file.
Comment 1 Mark Thomas 2020-09-18 12:17:31 UTC
Thanks for the report. This looks like a regression in 64548.

I have this issue fixed locally but that has uncovered another issue (Jasper is required). I'm currently working on the Jasper issue.
Comment 2 Mark Thomas 2020-09-18 20:15:51 UTC
Fixed in:
- master for 10.0.0-M9 onwards
- 9.0.x for 9.0.39 onwards

You may want to build with source and test this. I checked the very obvious but I wouldn't be surprised if there were other code paths that had issues under JPMS.
Comment 3 Guy Veraghtert 2020-09-18 20:50:27 UTC
I did a quick test with the 9.0.x branch. All our application tests are running again, and [Apache Tomcat/9.0.39-dev] started successfully.

I will do some more testing over the weekend and let you know when I run into other problems.
Comment 4 rotty3000 2020-09-30 13:03:48 UTC
Nice fix markt!