微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spring Boot 应用程序未启动

如何解决Spring Boot 应用程序未启动

我的 Spring Boot 应用程序无法启动。我无法找到根本原因。我想 Hikari 池可能会为此造成问题。下面是日志。任何帮助将不胜感激。

{"timestamp": "12/22/2020 14:48:58:0354","class": "com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator","file": "HikariPool.java","level" : "DEBUG","line_number" : "728","url": "","ip_address": "","server_trace_id":"","message": HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@b986d4e,"method": "call","thread_name": "HikariPool-1 connection adder"},{"timestamp": "12/22/2020 14:48:58:0368","class": "com.zaxxer.hikari.HikariDataSource","file": "HikariDataSource.java","level" : " INFO","line_number" : "350","message": HikariPool-1 - Shutdown initiated...,"method": "close","thread_name": "restartedMain"},{"timestamp": "12/22/2020 14:48:58:0369","class": "com.zaxxer.hikari.pool.HikariPool","line_number" : "421","message": HikariPool-1 - Before shutdown stats (total=6,active=0,idle=6,waiting=0),"method": "logPoolState",{"timestamp": "12/22/2020 14:48:58:0375","class": "com.zaxxer.hikari.pool.PoolBase","file": "PoolBase.java","line_number" : "134","message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@25f592ec: (connection evicted),"method": "quietlyCloseConnection","thread_name": "HikariPool-1 connection closer"},{"timestamp": "12/22/2020 14:48:58:0378","message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@36e8820f: (connection evicted),{"timestamp": "12/22/2020 14:48:58:0379","message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@382f7aa2: (connection evicted),{"timestamp": "12/22/2020 14:48:58:0380","message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@3c10e97f: (connection evicted),"message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@79127099: (connection evicted),{"timestamp": "12/22/2020 14:48:58:0381","message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@b986d4e: (connection evicted),{"timestamp": "12/22/2020 14:48:58:0388","message": HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@48a1ecf5,"message": HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@48a1ecf5: (connection evicted),{"timestamp": "12/22/2020 14:48:58:0389","message": HikariPool-1 - After shutdown stats (total=0,idle=0,"line_number" : "352","message": HikariPool-1 - Shutdown completed.,{"timestamp": "12/22/2020 14:48:58:0390","class": "org.apache.http.impl.conn.PoolingHttpClientConnectionManager","file": "PoolingHttpClientConnectionManager.java","line_number" : "411","message": Connection manager is shutting down,"method": "shutdown","class": "com.amazonaws.http.IdleConnectionReaper","file": "IdleConnectionReaper.java","line_number" : "190","message": Reaper thread:,"method": "run","thread_name": "java-sdk-http-connection-reaper"},java.lang.InterruptedException: sleep interrupted
    at java.lang.Thread.sleep(Native Method) ~[?:?]
    at com.amazonaws.http.IdleConnectionReaper.run(IdleConnectionReaper.java:188) [aws-java-sdk-core-1.11.908.jar:?]
IdleConnectionReaper.java:188
{"timestamp": "12/22/2020 14:48:58:0390","line_number" : "194","message": Shutting down reaper thread.,"class": "org.apache.http.impl.conn.LoggingManagedHttpClientConnection","file": "LoggingManagedHttpClientConnection.java","line_number" : "79","message": http-outgoing-0: Close connection,{"timestamp": "12/22/2020 14:48:58:0391","class": "com.amazonaws.internal.SdkSSLSocket","file": "SdkSSLSocket.java","line_number" : "76","message": shutting down output of xxx,"method": "shutdownOutput","line_number" : "69","message": shutting down input of xxx,"method": "shutdownInput","line_number" : "62","message": closing xxx,"line_number" : "434","message": Connection manager shut down,{"timestamp": "12/22/2020 14:48:58:0395","class": "org.apache.juli.logging.DirectJDKLog","file": "DirectJDKLog.java","line_number" : "173","message": Stopping service [Tomcat],"method": "log",

这是我使用过的项目的完整 maven 配置。我正在使用 spring boot 2.4.3 和 spring data jpa

<?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 https://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.4.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
  </parent>
  <groupId>xxx</groupId>
  <artifactId>xxx</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>xxxn</name>
  <description>Application of xxx</description>

  <properties>
    <java.version>14</java.version>
    <java.aws.version>1.11.908</java.aws.version>

    <sonar.projectKey>xxxx</sonar.projectKey>
    <sonar.organization>xxx</sonar.organization>
    <sonar.host.url>xxx</sonar.host.url>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>

    <dependency>
      <groupId>com.lmax</groupId>
      <artifactId>disruptor</artifactId>
      <version>3.3.7</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

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

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>

    <!-- AWS related dependencies -->
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-secretsmanager</artifactId>
      <version>${java.aws.version}</version>
    </dependency>

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-spring-cloud-config-client</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-bus</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt</artifactId>
      <version>0.9.1</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!--rest-assured dependency -->
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.7</version>
    </dependency>

    <dependency>
      <groupId>com.auth0</groupId>
      <artifactId>java-jwt</artifactId>
      <version>3.10.3</version>
    </dependency>


    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger2</artifactId>
      <version>2.9.2</version>
    </dependency>

    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>2.9.2</version>
    </dependency>
    <dependency>
      <groupId>io.swagger.codegen.v3</groupId>
      <artifactId>swagger-codegen-maven-plugin</artifactId>
      <version>3.0.23</version>
      <exclusions>
        <exclusion>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.mapstruct</groupId>
      <artifactId>mapstruct</artifactId>
      <version>1.4.1.Final</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.connect</groupId>
      <artifactId>atlassian-connect-spring-boot-jwt</artifactId>
      <version>2.1.2</version>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.7</version>
    </dependency>

    <dependency>
      <groupId>com.auth0</groupId>
      <artifactId>java-jwt</artifactId>
      <version>3.10.3</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <mainClass>com.ai.redpen.RedpenApplication</mainClass>
          <source>14</source>
          <target>14</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-codegen-maven-plugin</artifactId>
        <version>2.3.1</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/misc/swagger/swagger.yaml</inputSpec>
              <language>spring</language>
              <library>spring-boot</library>
              <apiPackage>com.ai.redpen.controller</apiPackage>
              <modelPackage>com.ai.redpen.dto</modelPackage>
              <generateApis>true</generateApis>
              <generateModels>true</generateModels>
              <generateApiTests>false</generateApiTests>
              <generateModelTests>false</generateModelTests>
              <skipOverwrite>false</skipOverwrite>
              <generateSupportingFiles>false</generateSupportingFiles>
              <configOptions>
                <interfaceOnly>true</interfaceOnly>
                <java8>false</java8>
                <dateLibrary>java8</dateLibrary>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <annotationProcessorPaths>
            <path>
              <groupId>org.mapstruct</groupId>
              <artifactId>mapstruct-processor</artifactId>
              <version>1.4.1.Final</version>
            </path>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。