Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Closing JPA EntityManagerFactory for persistence unit 'default' Shutdown initiated... Shutdown completed

Ask Question

I am creating a brand new spring boot application, I have the below dependencies.

<artifactId>spring-boot-starter</artifactId>
<artifactId>spring-boot-starter-test</artifactId>
<artifactId>spring-kafka</artifactId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<artifactId>spring-boot-starter-actuator</artifactId>
<artifactId>lombok</artifactId>
<artifactId>mysql-connector-java</artifactId>

The application starts but it shutsdown with below warning logs.

2022-02-25 23:58:10.225  INFO 72504 --- [           main] c.d.c.l.LibrarydemoApplication           : Started LibrarydemoApplication in 1.512 seconds (JVM running for 2.016)
2022-02-25 23:58:10.230  INFO 72504 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-02-25 23:58:10.232  INFO 72504 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2022-02-25 23:58:10.236  INFO 72504 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Mysql connectivity is good. below is the config of application props.

spring.datasource.url=jdbc:mysql://localhost:3306/repo
spring.datasource.username=
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update

Please advise how resolve this issue.

The app started and then exited successfully. Looks like you want it to be a webapp and for that you need to start a webserver. You can do by adding spring-boot-starter-web dependency to your app.It will add spring-boot-starter-tomcat to your app.

In your maven file add this

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

You can then get rid of spring-boot-starter as it is included with starter-web dependency

what if spring-boot-starter-web is already included in pom.xml but still the error persist? – Harish Kumar Feb 21 at 5:28

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.