Java 11 Modules (e.g., Jigsaw) are not working after 2.3.4.RELEASE of Spring Boot
Spring boot cannot load the Tomcat component.
See the example repo with the problem https://github.com/AcaDemIQ/spring-boot-gradle-jigsaw-demo
I try to run it as Java module using JetBrains IDEA (not via bootRun)
/home/mukhin/.jdks/adopt-openjdk-11.0.11/bin/java ... -m com.example.demo/com.example.demo.SpringBootDemoApplication
Comment From: wilkinsona
This doesn't look like a Spring Boot problem to me. You haven't stated that your application requires org.apache.tomcat.embed.core
. If you do that, you'll then hit this Tomcat bug which can be addressed by upgrading to Spring Boot 2.3.10.RELEASE which uses Tomcat 9.0.45.
Comment From: AcaDemIQ
On the Spring Boot 2.3.10.RELEASE I have this bug too...
:: Spring Boot :: (v2.3.10.RELEASE)
2021-05-07 16:07:50.962 INFO 27234 --- [ main] c.e.demo.SpringBootDemoApplication : Starting SpringBootDemoApplication on alex-fly with PID 27234 (/home/mukhin/IdeaProjects/spring-boot-gradle-jigsaw-demo/build/classes/java/main started by mukhin in /home/mukhin/IdeaProjects/spring-boot-gradle-jigsaw-demo)
2021-05-07 16:07:50.964 INFO 27234 --- [ main] c.e.demo.SpringBootDemoApplication : No active profile set, falling back to default profiles: default
2021-05-07 16:07:51.242 INFO 27234 --- [ main] c.e.demo.SpringBootDemoApplication : Started SpringBootDemoApplication in 0.436 seconds (JVM running for 1.054)
On the Spring Boot 2.3.3.RELEASE I can run Tomcat...
:: Spring Boot :: (v2.3.3.RELEASE)
2021-05-07 16:08:41.641 INFO 27469 --- [ main] c.e.demo.SpringBootDemoApplication : Starting SpringBootDemoApplication on alex-fly with PID 27469 (/home/mukhin/IdeaProjects/spring-boot-gradle-jigsaw-demo/build/classes/java/main started by mukhin in /home/mukhin/IdeaProjects/spring-boot-gradle-jigsaw-demo)
2021-05-07 16:08:41.643 INFO 27469 --- [ main] c.e.demo.SpringBootDemoApplication : No active profile set, falling back to default profiles: default
2021-05-07 16:08:42.038 INFO 27469 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-05-07 16:08:42.042 INFO 27469 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-05-07 16:08:42.042 INFO 27469 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2021-05-07 16:08:42.067 INFO 27469 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-05-07 16:08:42.068 INFO 27469 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 403 ms
2021-05-07 16:08:42.137 INFO 27469 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-07 16:08:42.228 INFO 27469 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-05-07 16:08:42.238 INFO 27469 --- [ main] c.e.demo.SpringBootDemoApplication : Started SpringBootDemoApplication in 0.749 seconds (JVM running for 1.262)
Comment From: AcaDemIQ
@wilkinsona may I create a new issue with new information about this "bug"? I check this negative behavior after 2.3.4, and it works find below (and equal) version 2.3.3
Comment From: bclozel
Works fine for me:
:: Spring Boot :: (v2.3.10.RELEASE)
2021-05-07 11:26:15.568 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : Starting SpringBootDemoApplication on bclozel-a01.vmware.com with PID 62729 (/Users/bclozel/workspace/tmp/spring-boot-gradle-jigsaw-demo/build/classes/java/main started by bclozel in /Users/bclozel/workspace/tmp/spring-boot-gradle-jigsaw-demo)
2021-05-07 11:26:15.571 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : No active profile set, falling back to default profiles: default
2021-05-07 11:26:16.221 INFO 62729 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-05-07 11:26:16.232 INFO 62729 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-05-07 11:26:16.232 INFO 62729 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-05-07 11:26:16.293 INFO 62729 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-05-07 11:26:16.294 INFO 62729 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 670 ms
2021-05-07 11:26:16.383 INFO 62729 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-07 11:26:16.554 INFO 62729 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-05-07 11:26:16.563 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : Started SpringBootDemoApplication in 1.242 seconds (JVM running for 1.936)
Note that the module dependency on com.example.module
is also missing (otherwise the module controller will not show up).
You've already reported an issue with the original project and I believe this is the right path forward.
Comment From: AcaDemIQ
Works fine for me:
``` :: Spring Boot :: (v2.3.10.RELEASE)
2021-05-07 11:26:15.568 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : Starting SpringBootDemoApplication on bclozel-a01.vmware.com with PID 62729 (/Users/bclozel/workspace/tmp/spring-boot-gradle-jigsaw-demo/build/classes/java/main started by bclozel in /Users/bclozel/workspace/tmp/spring-boot-gradle-jigsaw-demo) 2021-05-07 11:26:15.571 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : No active profile set, falling back to default profiles: default 2021-05-07 11:26:16.221 INFO 62729 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2021-05-07 11:26:16.232 INFO 62729 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-05-07 11:26:16.232 INFO 62729 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45] 2021-05-07 11:26:16.293 INFO 62729 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-05-07 11:26:16.294 INFO 62729 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 670 ms 2021-05-07 11:26:16.383 INFO 62729 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2021-05-07 11:26:16.554 INFO 62729 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-05-07 11:26:16.563 INFO 62729 --- [ main] c.e.demo.SpringBootDemoApplication : Started SpringBootDemoApplication in 1.242 seconds (JVM running for 1.936) ```
Note that the module dependency on
com.example.module
is also missing (otherwise the module controller will not show up). You've already reported an issue with the original project and I believe this is the right path forward.
How do you run this project? As module or via bootRun
from Gradle? The second method works fine, but it is not a right method (it run only main class, not module (if I understand correctly))
Comment From: bclozel
I'm running it with IDEA as a regular run configuration.
java -p /Users/bclozel/workspace/tmp/spring-boot-gradle-jigsaw-demo/build/classes/java/main:... -m com.example.demo/com.example.demo.SpringBootDemoApplication
Comment From: AcaDemIQ
@bclozel, thank you! Your help solves my problem with Java Modules, and I understand it :)
see: https://github.com/AcaDemIQ/spring-boot-gradle-jigsaw-demo
I just added some dependencies (module and TomCat) in the module-info.java.