首页 > 解决方案 > 如何调试Springboot“无法启动bean'webServerStartStop'......无法在Digital Ocean droplet上启动嵌入式Tomcat服务器

问题描述

我正在尝试在 Digital Ocean 液滴上运行启用了 HTTPS 的 Springboot 应用程序。该应用程序之前运行没有问题,直到最近从服务器重新启动。

我不断收到“无法启动 bean 'webServerStartStop'...无法启动嵌入式 Tomcat 服务器”错误。

我该如何开始调试呢?我试图从 .txt 文件中捕获来自服务器的输出日志,这就是输出。

我尝试过的事情:

我在跑:

2021-07-09 04:04:37.224 INFO 9278 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2021-07-09 04:04:37.238 INFO 9278 --- [ task-1] j.LocalContainerEntityManagerFactoryBean
: Initialized JPA EntityManagerFactory for persistence unit 'default' 2021-07-09 04:04:40.570 INFO 9278 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/oauth/token'], Ant [pattern='/oauth/token_key'],
Ant [pattern='/oauth/check_token']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@4248b963, org.springframework.security.web.context.SecurityContextPersistenceFilter@1dc76fa1, org.springframework.security.web.header.HeaderWriterFilter@2f508f3c,
org.springframework.security.web.authentication.logout.LogoutFilter@ad9e63e, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@3abfe845, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@33d53216, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7808f638,
org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7f08caf, org.springframework.security.web.session.SessionManagementFilter@2459319c, org.springframework.security.web.access.ExceptionTranslationFilter@71f0b72e, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2650f79]
2021-07-09 04:04:40.607 INFO 9278 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration$NotOAuthRequestMatcher@7be3a9ce, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@37d871c2,
org.springframework.security.web.context.SecurityContextPersistenceFilter@2c0b4c83, org.springframework.security.web.header.HeaderWriterFilter@4893b344, org.springframework.web.filter.CorsFilter@3baf6936, org.springframework.security.web.authentication.logout.LogoutFilter@3bfc6a5e,
org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter@62db0521, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@78525ef9, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2d0ecb24,
org.springframework.security.web.authentication.AnonymousAuthenticationFilter@285f38f6, org.springframework.security.web.session.SessionManagementFilter@53a665ad, org.springframework.security.web.access.ExceptionTranslationFilter@249e0271, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@4acb2510]
2021-07-09 04:04:40.610 INFO 9278 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@27b2faa6, org.springframework.security.web.context.SecurityContextPersistenceFilter@57c47a9e,
org.springframework.security.web.header.HeaderWriterFilter@4eed2acf, org.springframework.security.web.authentication.logout.LogoutFilter@61d84e08, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@642505c7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@4339e0de,
org.springframework.security.web.authentication.AnonymousAuthenticationFilter@6428591a, org.springframework.security.web.session.SessionManagementFilter@36fc05ff, org.springframework.security.web.access.ExceptionTranslationFilter@476e8796, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@715d6168]
2021-07-09 04:04:40.779 WARN 9278 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop';
nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server 2021-07-09 04:04:40.784 INFO 9278 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence
unit 'default' 2021-07-09 04:04:40.785 INFO 9278 --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2021-07-09 04:04:40.786 DEBUG 9278 --- [ main] org.hibernate.SQL
: alter table contacts drop foreign key FKna8bddygr3l3kq1imghgcskt8 2021-07-09 04:04:40.808 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table leads drop foreign key FK50ynw1akb9fok4ronueu0efpk 2021-07-09 04:04:40.934 DEBUG 9278 --- [ main] org.hibernate.SQL
: alter table leads drop foreign key FK10u8b7klywjncgkn7xffx7ncu 2021-07-09 04:04:41.033 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table leads_notes drop foreign key FKhpoad9uf9y5lh6nv7iqb06uk2 2021-07-09 04:04:41.065 DEBUG 9278 --- [ main] org.hibernate.SQL
: alter table leads_notes drop foreign key FK6tw7yuipyu91x1d4csegdumpt 2021-07-09 04:04:41.093 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table submissions drop foreign key FKpy8k2vjp2ax1glqn4tc77f362 2021-07-09 04:04:41.169 DEBUG 9278 --- [ main]
org.hibernate.SQL : alter table submissions drop foreign key FKhwyuy355rlq3e0d1lw5nxywum 2021-07-09 04:04:41.196 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table submissions drop foreign key FKhfixvturyi8nqcvr8qbujkmmd 2021-07-09 04:04:41.227 DEBUG
9278 --- [ main] org.hibernate.SQL : alter table submissions drop foreign key FKaddc6b566b2j07ndp34akltik 2021-07-09 04:04:41.252 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table users drop foreign key FKin8gn4o1hpiwe6qe4ey7ykwq7 2021-07-09 04:04:41.300
DEBUG 9278 --- [ main] org.hibernate.SQL : alter table users_roles drop foreign key FKa62j07k5mhgifpp955h37ponj 2021-07-09 04:04:41.331 DEBUG 9278 --- [ main] org.hibernate.SQL : alter table users_roles drop foreign key FK2o0jvgh89lemvvo17cbqvdxaa 2021-07-09
04:04:41.353 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists categories 2021-07-09 04:04:41.361 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists companies 2021-07-09 04:04:41.377 DEBUG 9278 --- [ main] org.hibernate.SQL
: drop table if exists contacts 2021-07-09 04:04:41.397 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists leads 2021-07-09 04:04:41.446 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists leads_notes 2021-07-09 04:04:41.465 DEBUG
9278 --- [ main] org.hibernate.SQL : drop table if exists leads_status 2021-07-09 04:04:41.474 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists products 2021-07-09 04:04:41.482 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists
roles 2021-07-09 04:04:41.493 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists submissions 2021-07-09 04:04:41.503 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists submissions_status 2021-07-09 04:04:41.517 DEBUG 9278 ---
[ main] org.hibernate.SQL : drop table if exists users 2021-07-09 04:04:41.537 DEBUG 9278 --- [ main] org.hibernate.SQL : drop table if exists users_roles 2021-07-09 04:04:41.560 INFO 9278 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting
down ExecutorService 'applicationTaskExecutor' 2021-07-09 04:04:41.564 INFO 9278 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-07-09 04:04:41.585 INFO 9278 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1
- Shutdown completed. 2021-07-09 04:04:41.599 INFO 9278 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2021-07-09 04:04:41.636 INFO 9278 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext.
To display the conditions report re-run your application with 'debug' enabled. 2021-07-09 04:04:41.652 ERROR 9278 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.context.ApplicationContextException: Failed to start
bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185)
~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at com.maxwelton.investorportal.InvestorPortalBackendApplication.main(InvestorPortalBackendApplication.java:10)
~[classes!/:0.0.1-SNAPSHOT] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[investor-portal-backend-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
~[investor-portal-backend-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[investor-portal-backend-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
~[investor-portal-backend-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229)
~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE] ... 22 common frames omitted Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213)
~[spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE] ... 24 common frames omitted Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:1058) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] ... 26 common
frames omitted Caused by: java.lang.IllegalArgumentException: None of the [protocols] specified are supported by the SSL engine : [[TSLv1.2]] at org.apache.tomcat.util.net.SSLUtilBase.getEnabled(SSLUtilBase.java:151) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35]
at org.apache.tomcat.util.net.SSLUtilBase.
<init>(SSLUtilBase.java:109) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.SSLUtilBase.
  <init>(SSLUtilBase.java:83) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.openssl.OpenSSLUtil.
    <init>(OpenSSLUtil.java:42) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.openssl.OpenSSLImplementation.getSSLUtil(OpenSSLImplementation.java:36) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:88)
      ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:216)
      ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1141) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1227)
      ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:592) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35] at org.apache.catalina.connector.Connector.startInternal(Connector.java:1055) ~[tomcat-embed-core-9.0.35.jar!/:9.0.35]
      ... 28 common frames omitted

我的数据库属性是

spring.datasource.url=jdbc:mysql://localhost/db_investor_portal?useLegacyDatetimeCode=false&serverTimezone=UTC&useSSL=true
spring.datasource.username=**********
spring.datasource.password=**********

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.jpa.hibernate.ddl-auto=create-drop

spring.jackson.serialization.fail-on-empty-beans=false
logging.level.org.hibernate.SQL=debug

spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB

#SpringBoot SSL configuration for Digital Ocean
#server.ssl.enabled=true
#server.port=8443
#server.ssl.key-store=/etc/letsencrypt/live/*****
#server.ssl.key-store-password=***********
#server.ssl.key-store-type=PKCS12
#server.ssl.protocol=TLS
#server.ssl.enabled-protocols=TSLv1.2
#server.ssl.ciphers=TSL_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256, TLS_AES_128_GCM_SHA256

还有我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.maxwelton.investorportal</groupId>
    <artifactId>investor-portal-backend</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>investor-portal-backend</name>
    <packaging>jar</packaging>
    <description>Backend for MW Investor Portal</description>

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

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
            <version>8.0.24</version><!--$NO-MVN-MAN-VER$-->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>2.3.5.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-jwt -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-jwt</artifactId>
            <version>1.0.10.RELEASE</version>
        </dependency>       
        <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>           
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-tomcat</artifactId>
          <scope>provided</scope>
        </dependency>
        
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <mainClass>${start-class}</mainClass>
                </configuration>
                  <executions>
                    <execution>
                      <goals>
                        <goal>repackage</goal>
                      </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.maxwelton.investorportal.InvestorPortalBackendApplication</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

标签: javaspring-bootdigital-ocean

解决方案


推荐阅读