Spring boot not running on external tomcat
I have previously worked with Spring Boot on Java 1.8 and Tomcat 8. I recently started a new project where I upgraded to Java 17, Tomcat 10.
I'm trying to deploy as a war to run in an external tomcat, but it doesn't work.
I ran and deployed the project without any problems in the existing Java 1.8 and Tomcat 8 in the actual production environment. I think you know how to deploy spring boot as war.
I have read the Spring Boot official documentation at the link below. https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.traditional-deployment.war
My project's pom.xml has the settings below applied.
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
And
<configuration>
<mainClass>mypackage.SpringBootCoreApplication</mainClass>
</configuration>
And SpringBootApplication is also configured.
@SpringBootApplication
public class SpringBootCoreApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootCoreApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootCoreApplication.class, args);
}
}
Now, I ran Tomcat to deploy as war, and the following log came out.
31-Oct-2022 19:52:47.382 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
31-Oct-2022 19:52:43.818 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ROOT.war]
31-Oct-2022 19:52:43.780 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.1.1]
31-Oct-2022 19:52:43.779 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
31-Oct-2022 19:52:43.686 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [961] milliseconds
31-Oct-2022 19:52:43.618 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:43.069 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.2 15 Mar 2022]
31-Oct-2022 19:52:43.063 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.1] using APR version [1.7.0].
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Eclipse Adoptium
31-Oct-2022 19:52:43.032 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 17.0.4.1+1
31-Oct-2022 19:52:43.032 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /opt/java/openjdk
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.4.180+
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
31-Oct-2022 19:52:43.030 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.1.1.0
31-Oct-2022 19:52:43.030 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Oct 3 2022 12:42:14 UTC
31-Oct-2022 19:52:43.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.1.1
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Using CATALINA_OPTS:
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using JRE_HOME: /opt/java/openjdk
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_BASE: /usr/local/tomcat
31-Oct-2022 19:52:41.636 INFO [Thread-1] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:41.627 INFO [Thread-1] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:41.612 INFO [Thread-1] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
31-Oct-2022 19:52:41.608 INFO [Thread-1] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:48:16.236 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/ROOT.war] has finished in [4,098] ms
Spring Boot as I remember it doesn't end up with logs like this. The project is running but spring boot doesn't seem to be running.
The log shows that it was successful, but it doesn't actually connect.
I read the official Spring Boot documentation, many questions/answers, and blog posts, but I couldn't solve it.
I don't know what I have configured wrong. please help me