Эластичный бобовый стебель Tomcat показывает 504 после добавления зависимости spring-boot-starter-data-jpa в pom.xml

#spring-boot #jpa #tomcat #amazon-elastic-beanstalk #amazon-rds

Вопрос:

у меня следующая проблема: Я пытаюсь развернуть приложение springboot в Elastic Beanstalk с помощью Tomcat. Так что я упаковываю его как военный файл. До сих пор в этом нет никаких ошибок. Но мне также нужно подключение к базе данных mysql. Поэтому мне нужна зависимость spring-boot-starter-data-jpa. После добавления этого и развертывания в elastic Beanstalk он сначала показывает мне тайм-аут шлюза 504, а затем после обновления страницы с ошибкой 404, даже не с белой меткой, а просто 404. И я чувствую, что это как-то связано с зависимостью от jpa.

Я также тестировал другие проекты tomcat, но каждый раз, когда я добавляю зависимость jpa, появляется 404. В журналах вообще нет ошибок. Я также думаю, что это может иметь какое-то отношение к правилам AWS или авторизации. Но я не знаю, чего мне не хватает, так как журналы также не показывают ошибок в AWS.

Вот мой pom.xml

 <groupId>com.test</groupId>
<artifactId>productionDataList</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>

<name>backendPlanningTool</name>
<description>Planing System</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <start-class>com.test.productionData.AccessingDataMysqlApplication</start-class>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <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-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency> 
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</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>
        </plugin>
    </plugins>
</build>
 

И вот мое приложение основной класс:

 package com.test.productionData;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class AccessingDataMysqlApplication extends SpringBootServletInitializer {

  public static void main(String[] args) {
    SpringApplication.run(AccessingDataMysqlApplication.class, args);
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(AccessingDataMysqlApplication.class);
}
}
 

здесь мое приложение.свойства с AWS RDS моя база данных sqldatabase

 spring.thymeleaf.cache=true
spring.datasource.url=jdbc:mysql://<myurl>:3306/databasename?serverTimezone=Europe/Berlinamp;useSSL=falseamp;requireSSL=false
spring.datasource.username=**
spring.datasource.password=**
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=update


## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect

# Hibernate ddl auto (create, create-drop, validate, update)
 

Also here the logs from AWS:

tomcat catalina log: enter image description here

tomcat localhost: enter image description here

Like I said, everything works fine without the jpa dependency, also the mysql connection works as I tested the connection with heidiSQL, I also added tables etc to my AWS RDS remotely.

But I need the jpa dependecy, maybe it conflicts with another dependency??

I just saw this error which is shown in the logs: Healthcheck error
So it seems something is wrong with load balancer, thats why there is a 504 error at first sight?

I appreciate every help. Thank you.