Spring Boot Application immediately closing after startup
Answered
I am working currently on a project which includes the Spring Framework. Everything is working as aspect but there is one problem. When I try to start my application onto my laptop it immediately shuts down after startup. It is working on every other machine, so this problem occurs only on my laptop.
Maybe you got an idea what could force this problem ? I am working with IntelliJ and I haven´t found any solutions for this problem.
PC Specs
- Laptop is a AsusN550JK( modified RAM and SSD)
- Intel Core i7-4700HQ CPU@2.4 GHz
- 16 GB Ram
- 500 GB SSD Samsung EVO 840
- 1 TB HDD
- 64 Bit OS - Windows 10
Console Log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.2.RELEASE)
2017-04-22 18:49:31.784 INFO 14184 --- [ main] com.objectbay.test.me.Application : Starting Application on AsusN550JK with PID 14184 (D:\Diplomarbeit\springtestframework\target\classes started by Michael in D:\Diplomarbeit\springtestframework)
2017-04-22 18:49:31.794 INFO 14184 --- [ main] com.objectbay.test.me.Application : No active profile set, falling back to default profiles: default
2017-04-22 18:49:31.943 INFO 14184 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@77846d2c: startup date [Sat Apr 22 18:49:31 CEST 2017]; root of context hierarchy
2017-04-22 18:49:34.534 INFO 14184 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-04-22 18:49:34.669 INFO 14184 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-04-22 18:49:34.789 INFO 14184 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-04-22 18:49:34.792 INFO 14184 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2017-04-22 18:49:34.794 INFO 14184 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-04-22 18:49:34.876 INFO 14184 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-04-22 18:49:35.070 INFO 14184 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-04-22 18:49:36.423 INFO 14184 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-04-22 18:49:36.450 INFO 14184 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2017-04-22 18:49:36.520 INFO 14184 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-04-22 18:49:38.116 INFO 14184 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-04-22 18:49:38.155 INFO 14184 --- [ main] com.objectbay.test.me.Application : Started Application in 7.145 seconds (JVM running for 8.204)
2017-04-22 18:49:38.158 INFO 14184 --- [ Thread-4] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@77846d2c: startup date [Sat Apr 22 18:49:31 CEST 2017]; root of context hierarchy
2017-04-22 18:49:38.161 INFO 14184 --- [ Thread-4] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-04-22 18:49:38.162 INFO 14184 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-04-22 18:49:38.163 INFO 14184 --- [ Thread-4] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-04-22 18:49:38.177 INFO 14184 --- [ Thread-4] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
Process finished with exit code 0
pom.xml - file
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-accessing-data-rest</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
this example is working on my laptop : https://spring.io/guides/gs/accessing-data-rest/
Please sign in to leave a comment.
Does it happen if the app is started outside of IntelliJ IDEA, in the console?
Same issue if I try to start it from the terminal.
In this case the problem is not specific to IntelliJ IDEA. You will have a higher chance to get an answer at http://stackoverflow.com/questions/43562170/spring-boot-application-immediatly-shuts-down-after-starting.
As far as I can see, the following answers may help you:
http://stackoverflow.com/questions/22380119/why-my-spring-boot-app-always-shutdown
http://stackoverflow.com/questions/28017784/how-to-prevent-spring-boot-daemon-server-application-from-closing-shutting-down
Thank you for your quick answer, but the first post on stackoverflow is exactly from me
The other 2 posts had not helped me, I have read them before I ´ve posted my issue in this forum.
> Thank you for your quick answer, but the first post on stackoverflow is exactly from me
I know, just telling you that asking in IntelliJ IDEA forum is not the proper place for this problem.
> The other 2 posts had not helped me, I have read them before I ´ve posted my issue in this forum.
So, you've tried adding `spring-boot-starter-web` dependency as well as `Thread.currentThread().join()` approach and the app still shuts down?
> So, you've tried adding `spring-boot-starter-web` dependency as well as `Thread.currentThread().join()` approach and the app still shuts down?
Yes, I´ve tried these workarounds but they didn´t work. The last hope for me was that someone of the IntelliJ IDEA Team has a solution for this strange problem.
I've noticed the following on your screenshot:
It looks like Tomcat dependency jar on your system is corrupted. Remove this jar and run "mvn clean install" so that it's downloaded again.
The log also doesn't show that Tomcat is started, so it seems to be the root case, otherwise you'd see something like this: