JRM
JRM

Reputation: 27

Spring Boot app automatically shutdown after running

I keep getting this log whenever I try to run my app. I have tried to add more parameters on my application.properties (like spring.jpa.hibernate.ddl-auto=update) but that would only break the app and show more errors. I can't found my way to get this fixed.

2021-04-23 11:21:00.351  INFO 6292 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-04-23 11:21:01.019  INFO 6292 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-04-23 11:21:01.074  INFO 6292 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-04-23 11:21:01.148  INFO 6292 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.28.Final
2021-04-23 11:21:01.562  INFO 6292 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-04-23 11:21:01.747  INFO 6292 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-04-23 11:21:02.552  INFO 6292 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-04-23 11:21:02.562  INFO 6292 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-04-23 11:21:02.735  INFO 6292 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2021-04-23 11:21:02.752  INFO 6292 --- [  restartedMain] com.accenture.ws.Application             : Started Application in 4.503 seconds (JVM running for 5.792)
2021-04-23 11:21:02.763  INFO 6292 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-04-23 11:21:02.767  INFO 6292 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2021-04-23 11:21:02.784  INFO 6292 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

This is my pom.xml – Is there anything that I may have misconfigured on my 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 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.4.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.stackoverflow.net</groupId>
    <artifactId>application-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>application-test.stackoverflow</name>
    <description>application-test API</description>
    <properties>
        <java.version>11</java.version>
        <testcontainers.version>1.15.3</testcontainers.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-jdbc</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>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

And here is my application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/?user=root/devops_db?
useSSL=false&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC

spring.datasource.username=username
spring.datasource.password=password

server.error.include-stacktrace=never
spring.jackson.serialization.indent-output=true

server.port=8090

Upvotes: 1

Views: 932

Answers (2)

Praveen Kumar
Praveen Kumar

Reputation: 1

Can you set the logging level for org.springframework as debug along with spring.jpa.hibernate.ddl-auto=none and share the results . Also could you share the DataSource configurations

Upvotes: 0

Nikolas
Nikolas

Reputation: 44368

The Spring Boot application doesn't shutdown itself but the Hikari connection does. I see a problem with the data source URL: I have noticed a new line between ...devops_db? and useSSl=false... parts which should not be there.

Copy and paste this (i.e. replace the first two lines of your properties file with the following line):

spring.datasource.url=jdbc:mysql://localhost:3306/?user=root/devops_db?useSSL=false&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC

Upvotes: 1

Related Questions