为什么Tomcat无法在EC2上启动Spring-boot应用程序?

时间:2020-09-22 17:18:38

标签: spring spring-boot tomcat logging amazon-ec2

昨天我正在启动具有新功能的Spring-boot应用程序,但我的应用程序尚未启动。除了警告日志外,catalina.out中只有普通日志,也就是说我Tomcat 8将使用默认的xml版本而不是指定的地雷:

 21-Sep-2020 16:46:33.348 INFO [http-nio-8080-exec-65] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/share/tomcat9/webapps/mobile-app-ws-0.0.1-SNAPSHOT.war]
21-Sep-2020 16:46:43.484 WARNING [http-nio-8080-exec-65] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0].Default version will be used .
21-Sep-2020 16:46:33.348 INFO [http-nio-8080-exec-65]  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.
21-Sep-2020 16:46:43.622 INFO [http-nio-8080-exec-65] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/share/tomcat9/webapps/mobile-app-ws-0.0.1-SNAPSHOT.war] has finished in [10,272] ms
                       

这是由Tomcat 8使用xml 3.1版引起的,但是在我的pom.xml中将其设置为4.0。因此,我选择在Linux服务器上安装Tomcat 9。我当时在想我的应用程序无法启动,因为默认的Tomcat XML版本和pom.xml中的XML版本之间存在冲突。所以,我在这里。在Tomcat 9上,同样的简单日志,也不是哪里出了问题的线索:

22-Sep-2020 16:46:33.348 INFO [http-nio-8080-exec-65] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/share/tomcat9/webapps/mobile-app-ws-0.0.1-SNAPSHOT.war]
22-Sep-2020 16:46:43.484 INFO [http-nio-8080-exec-65] 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.
22-Sep-2020 16:46:43.622 INFO [http-nio-8080-exec-65] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/share/tomcat9/webapps/mobile-app-ws-0.0.1-SNAPSHOT.war] has finished in [10,272] ms.

在我的本地计算机上,在部署期间我有以下日志:

22-Sep-2020 19:46:49.238 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.37]
22-Sep-2020 19:46:49.253 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/home/etniqa/etniqa/utilities/apache-tomcat-9.0.37/webapps/mobile-app-ws-0.0.1-SNAPSHOT.war]
22-Sep-2020 19:46:58.919 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.
SOUT INTO MAIN CLASS INTO INIT-STATIC SNIPPET
22-Sep-2020 19:46:59.051 INFO [main] com.example.mobileappws.MobileAppWsApplication.<clinit> LOG INTO MAIN CLASS INTO INIT-STATIC SNIPPET

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.1.RELEASE)

2020-09-22 19:47:00.952  INFO 19842 --- [           main] c.e.mobileappws.MobileAppWsApplication   : Starting MobileAppWsApplication v0.0.1-SNAPSHOT on etniqa with PID 19842 (/home/etniqa/etniqa/utilities/apache-tomcat-9.0.37/webapps/mobile-app-ws-0.0.1-SNAPSHOT/WEB-INF/classes started by etniqa in /home/etniqa/etniqa/utilities/apache-tomcat-9.0.37/bin)

它运行完美。

一周前,我遇到了类似的问题。然后我只是在pom.xml中设置了JDK 8版本:

<properties>
    <java.version>1.8</java.version>
</properties>

Linux服务器上的版本: JDK:

openjdk版本“ 1.8.0_265”

Tomcat:

服务器版本:Apache Tomcat / 9.0.38

0 个答案:

没有答案
相关问题