Приложение Spring Boot не запускается при развертывании в Tomcat в Eclipse

-5

Я перенес свое приложение Spring Boot на Java 11, и с тех пор оно не запускается на Tomcat внутри Eclipse. Чтобы быть точным, Tomcat запускается, но нет никакого вывода из приложения Spring Boot, как если бы оно не было развернуто. Это также происходит только после миграции Java 11 и только при использовании Tomcat внутри Eclipse, когда я развертываю файл war в том же, но автономном Tomcat, он работает.

У вас есть идеи, что может быть причиной этого? Или я должен просто считать это проблемой Eclipse и ждать новой версии?

Я использую Eclipse 4.10.0 2018-12, Tomcat 9.0.14, Java 11.0.2, Spring Boot 2.1.1.

РЕДАКТИРОВАТЬ:

Вход в Tomcat начинается с Eclipse https://pastebin.com/ws2K1FUV

úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.14
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Dec 6 2018 21:13:53 UTC
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.14.0
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk-11.0.2
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 11.0.2+7-LTS
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\PATH\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Tomcat\apache-tomcat-9.0.14
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\PATH\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Tomcat\apache-tomcat-9.0.14
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\PATH\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
úno 07, 2019 10:23:20 DOP. org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
úno 07, 2019 10:23:20 DOP. org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.6.5].
úno 07, 2019 10:23:20 DOP. org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
úno 07, 2019 10:23:20 DOP. org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
úno 07, 2019 10:23:20 DOP. org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018]
úno 07, 2019 10:23:20 DOP. org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
úno 07, 2019 10:23:21 DOP. org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
úno 07, 2019 10:23:21 DOP. org.apache.catalina.startup.Catalina load
INFO: Server initialization in [1,692] milliseconds
úno 07, 2019 10:23:21 DOP. org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
úno 07, 2019 10:23:21 DOP. org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.14]
úno 07, 2019 10:23:23 DOP. org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [858] milliseconds.
úno 07, 2019 10:23:24 DOP. org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
úno 07, 2019 10:23:25 DOP. org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
úno 07, 2019 10:23:25 DOP. org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
úno 07, 2019 10:23:25 DOP. org.apache.catalina.startup.Catalina start
INFO: Server startup in [3,088] milliseconds

Войдите из Tomcat, начиная с автономной версии https://pastebin.com/LLZ4Hmcr

07-Feb-2019 11:28:33.241 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/9.0.14
07-Feb-2019 11:28:33.246 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Dec 6 2018 21:13:53 UTC
07-Feb-2019 11:28:33.246 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.14.0
07-Feb-2019 11:28:33.247 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
07-Feb-2019 11:28:33.247 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
07-Feb-2019 11:28:33.248 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
07-Feb-2019 11:28:33.248 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk-11.0.2
07-Feb-2019 11:28:33.248 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.2+7-LTS
07-Feb-2019 11:28:33.249 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
07-Feb-2019 11:28:33.249 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Tomcat\apache-tomcat-9.0.14
07-Feb-2019 11:28:33.250 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Tomcat\apache-tomcat-9.0.14
07-Feb-2019 11:28:33.251 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
07-Feb-2019 11:28:33.252 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
07-Feb-2019 11:28:33.253 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
07-Feb-2019 11:28:33.253 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Tomcat\apache-tomcat-9.0.14\conf\logging.properties
07-Feb-2019 11:28:33.254 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
07-Feb-2019 11:28:33.255 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
07-Feb-2019 11:28:33.259 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
07-Feb-2019 11:28:33.260 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dspring.config.location=file:C:/PATH/conf/
07-Feb-2019 11:28:33.261 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dlogging.config=file:C:/PATH/conf/logback-spring.xml
07-Feb-2019 11:28:33.262 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
07-Feb-2019 11:28:33.262 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Tomcat\apache-tomcat-9.0.14
07-Feb-2019 11:28:33.263 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Tomcat\apache-tomcat-9.0.14
07-Feb-2019 11:28:33.264 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Tomcat\apache-tomcat-9.0.14\temp
07-Feb-2019 11:28:33.265 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.6.5].
07-Feb-2019 11:28:33.266 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
07-Feb-2019 11:28:33.266 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
07-Feb-2019 11:28:33.275 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018]
07-Feb-2019 11:28:33.368 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
07-Feb-2019 11:28:34.405 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
07-Feb-2019 11:28:34.410 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1,710] milliseconds
07-Feb-2019 11:28:34.464 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
07-Feb-2019 11:28:34.465 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.14]
07-Feb-2019 11:28:34.486 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Tomcat\apache-tomcat-9.0.14\webapps\app.war]
07-Feb-2019 11:28:44.103 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.
07-Feb-2019 11:28:44.172 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [C:\Tomcat\apache-tomcat-9.0.14\webapps\app.war] has finished in [9,685] ms
07-Feb-2019 11:28:44.174 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\docs]
07-Feb-2019 11:28:44.211 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\docs] has finished in [38] ms
07-Feb-2019 11:28:44.212 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\examples]
07-Feb-2019 11:28:44.686 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\examples] has finished in [475] ms
07-Feb-2019 11:28:44.687 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\host-manager]
07-Feb-2019 11:28:44.734 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\host-manager] has finished in [47] ms
07-Feb-2019 11:28:44.735 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\manager]
07-Feb-2019 11:28:44.775 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\manager] has finished in [40] ms
07-Feb-2019 11:28:44.776 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\ROOT]
07-Feb-2019 11:28:44.809 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Tomcat\apache-tomcat-9.0.14\webapps\ROOT] has finished in [33] ms
07-Feb-2019 11:28:44.814 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
07-Feb-2019 11:28:44.825 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
07-Feb-2019 11:28:44.831 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [10,420] milliseconds

Оба журнала используют одну и ту же версию Tomcat и одну и ту же версию приложения. Но Затмение просто заканчивается так, как здесь. После этого автономный начинает записывать вывод Spring Boot на консоль.

спросил(а) 2021-01-19T13:04:45+03:00 6 месяцев назад
1
Решение
64

Я думаю, что вы можете сделать это, создав войну и выполнив следующие шаги:
1. Измените свою мавенскую упаковку <packaging>war</packaging>
2. Добавьте эту зависимость

<dependency>

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>

расширить SpringBootServletInitializer

@SpringBootApplication
public class SpringBootTomcatApplication extends SpringBootServletInitializer {
}

ответил(а) 2021-01-19T13:04:45+03:00 6 месяцев назад
45

Мне все еще не удавалось заставить его работать так же, как раньше с Java 8, но я обнаружил, что даже когда приложение построено как war и должно работать на внешнем Tomcat, я все равно могу запустить его в Eclipse как Приложение Spring Boot с использованием встроенного Tomcat. Это не совсем то, что я хотел, но, по крайней мере, оно позволяет создавать приложение так, как нам нужно, и в то же время иметь возможность отлаживать его непосредственно в Eclipse.

ответил(а) 2021-01-19T13:04:45+03:00 6 месяцев назад
Ваш ответ
Введите минимум 50 символов
Чтобы , пожалуйста,
Выберите тему жалобы:

Другая проблема