Shale
Shale

Reputation: 417

Spring boot "Hikari Pool Shutdown" early error

ERROR:

2018-11-12 18:25:31.221  INFO 3028 --- [       Thread-3] 
com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2018-11-12 18:25:31.223  INFO 3028 --- [       Thread-3] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Why does this error occur?

And how can I solve?

Upvotes: 22

Views: 72562

Answers (13)

UmeshWalagedara
UmeshWalagedara

Reputation: 1

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

you need to remove the scope.. Just comment it and refresh the maven or gradle and try running it

Upvotes: 0

KRISHNA CHANDRA RAI
KRISHNA CHANDRA RAI

Reputation: 1

Adding server worked for me

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

Upvotes: 0

nrdrtr
nrdrtr

Reputation: 41

I got the same error in my application and I removed the code block spring.main.web-application-type=none in the application.properties file and the problem was solved.

Upvotes: 1

Gothram
Gothram

Reputation: 67

Check if you have spring-boot-starter-web dependency in pom.xml If not then add it by adding the following dependency to pom.xml.

No need to add tomcat if you are not planning to use it any way.

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

Upvotes: 0

Tohid Makari
Tohid Makari

Reputation: 2494

For me it worked after removing following dependency:

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
    </dependency>

Upvotes: 0

Pavan Kalambe
Pavan Kalambe

Reputation: 11

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

I removed this dependency and it worked for me!

Upvotes: 1

LongDev
LongDev

Reputation: 219

I remove

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

and it works

Upvotes: 2

Roel
Roel

Reputation: 71

My issue was fixed by commenting out this dependency:

<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!--            <scope>provided</scope>-->
<!--        </dependency>-->

If still error encountered try just commenting the <scope tag in the code above.

Upvotes: 7

manjosh
manjosh

Reputation: 734

Check if you have <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency> in your pom.xml, remove it

Upvotes: 1

mumbasa
mumbasa

Reputation: 832

Check whether you have jpa dependency you do not use and remove it. Also add dependencies for tomcat and spring-boot-starter-web

Remove

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

add if not does not exist

<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-web</artifactId>
            
        </dependency>

Upvotes: 3

Steve T
Steve T

Reputation: 383

In my situation, I was studying a book on Kotlin, in the chapter about using Spring with Kotlin. I had the gradle project set up from using Spring Initializr. I was able to do a gradle clean and gradle build from the gradle tab in IntelliJ IDEA ide, with no problems. I then tried to run the project using the "run MyApplicationKt" found next to the "fun main()" top-level function found in MyApplication.kt. The spring boot project started ok at first, but as found in the original poster's example the Hikari Data Source shutdown, and the spring boot itself stopped.

2020-11-10 22:29:46.868  INFO 19536 --- [           main] c.agiledeveloper.todo.TodoApplicationKt  : Started TodoApplicationKt in 2.819 seconds (JVM running for 3.431)

2020-11-10 22:30:47.606  INFO 19536 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

2020-11-10 22:30:47.607  INFO 19536 --- [extShutdownHook] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'

2020-11-10 22:30:47.610  INFO 19536 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

2020-11-10 22:30:47.610  INFO 19536 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2020-11-10 22:30:47.615  INFO 19536 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

The problem was that I am new to Gradle, and the fix was to avoid above, and instead to go to Gradle tab > Tasks > application > bootRun, and this runs the app while avoiding shutdown. I was then able to access my RESTful web service running project using a curl command I was using.

For reference, why curl command was not working against my spring gradle REST project: Curl : connection refused

Upvotes: 1

Abd Abughazaleh
Abd Abughazaleh

Reputation: 5595

My problem was in pom.xml not included spring-boot-starter-web artifactId

1 - Add new the below dependency to pom.xml .

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

2 - Go to pom.xml right click and continue with image : enter image description here

Upvotes: 5

lcnicolau
lcnicolau

Reputation: 4158

It seems you don't have any embedded web servers in your classpath. Try adding Tomcat through the spring-boot-starter-web dependency.

Maven pom.xml:

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

Gradle build.gradle:

implementation 'org.springframework.boot:spring-boot-starter-web'

Upvotes: 34

Related Questions