Trying to deploy a Spring Boot 3.2 app in a layered docker I basically followed this blogpost and specifically, my docker entrypoint was:
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
Yet the docker doesn't start and display the usual
Error: Could not find or load main class org.springframework.boot.loader.JarLauncher
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.loader.JarLauncher
After some digging in the initial jar file, I found out that the JarLauncher class is actually under org.springframework.boot.loader.launch.JarLauncher
.
and if I replace the entrypoint by this one:
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]
The app actually starts.
Jumping back in the Spring Doc the package should still be org.springframework.boot.loader.JarLauncher
(according to the doc, I mean)
So... has the class JarLauncher been moved, and the documentation is outdated, or is it some mistake in my configuration? Since I can't find any documentation about this change (witch seems to be fairly important)
Of course the usual java -jar
command runs correctly since the manifest file is alright.
I double checked by starting a new project with a Spring Boot 2.7, and the JarLauncher class is indeed in the org.springframework.boot.loader
package
You are looking at a blog for Spring 2.3 and are using a non final Spring Boot 3.2.
The classes have moved, see this ticket and the documentation is perfectly fine if you look at the correct one. You looked at the current production version which is 3.1 and not 3.2 as that is still under development.
So in short that blog post is (sort of) outdated, the documentation is perfectly in order as long as you read the proper one.
This answer may help to solve some people's problem
for example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With