我已经将Spring Boot应用程序迁移到Java 11,此后,它无法在Eclipse中的Tomcat上启动。确切地说,Tomcat已启动,但Spring Boot应用程序中没有输出,就像不会部署一样。仅在Java 11迁移之后,并且仅在Eclipse中使用Tomcat时,当我将war文件部署到相同但独立的Tomcat时,它也可以工作。
您是否知道可能是什么原因造成的?还是我应该只考虑Eclipse问题并等待更新的版本?
我正在使用Eclipse 4.10.0 2018-12,Tomcat 9.0.14,Java 11.0.2,Spring Boot 2.1.1
编辑:
从Eclipse内部开始从Tomcat登录 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和相同版本的应用程序。但是Eclipse就这样结束了。此后,独立的人开始将Spring Boot输出写入控制台。
答案 0 :(得分:0)
我认为您可以通过发动战争并遵循以下步骤来做到这一点:
1.更改您的Maven包装
<packaging>war</packaging>
2.添加此依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
@SpringBootApplication
public class SpringBootTomcatApplication extends SpringBootServletInitializer {
}
答案 1 :(得分:0)
我仍然无法使其像以前使用Java 8那样运行,但是我发现即使将应用程序构建为战争版本并应在外部Tomcat上运行,我仍然可以运行它在Eclipse中作为Spring Boot应用程序使用嵌入式Tomcat。这并不是我真正想要的,但是它至少允许以我们所需的方式构建应用程序,同时能够直接在Eclipse中对其进行调试。