Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 343 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does my Spring Boot App always shutdown immediately after starting?

#11
in my case i already had the maven dependency to 'spring-boot-starter-web' and the project would start fine without auto-stopping when i run it as springboot app **from within the IDE**. however, when i deploy it to **K8s**, the app would start and auto-stop immediately. So i modified my main app class to extend SpringBootServletInitializer and this seems to have fixed the auto-stopping.

@SpringBootApplication public class MyApp extends SpringBootServletInitializer { public static void main(String[] args) {
SpringApplication.run(MyApp.class, args); }}
Reply

#12
I went through the answers here and elsewhere and still had issues. It turned that (like the op), I was running in kubernetes, and the app was fine, but kubernetes had an issue.

I forgot to have my app start based on my port environment variable. So, kubernetes/helm was telling it to run on 8443 and to liveness probe that, but it was running on some other port (like 8123) from my application.properties.

The kubernetes events (get events) showed the live-ness probe was failing, so kubernetes was killing the pod/app every 30 seconds or so.
Reply

#13
I was having a similar problem. I only had the following starter web package.

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

But it is not enough. You need to add a parent too to get other required dependencies.

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

#14
If you have a circular spring injected dependency it will fail without warning, depending on the level of logging, and a few other factors.

Class A injects Class B, and Class B injects Class A. Via constructor, in this particular case.
Reply

#15
I initialized a new SPring boot project in IntelliJIdea with Spring Boot dev tools, but in pom.xml I had only dependency

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


You need to have also artifact **spring-boot-starter-web**. Just add this dependency to pom.xml

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

#16
My application is Spring boot batch and commenting below line in application.properties resolved the problem

spring.main.web-application-type=none
Reply

#17
I had this problem, and in my case it was caused by a simple clumsy mistake: my class had:

@SpringBootApplication
public class MyApplication implements ApplicationRunner {

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

public void run(ApplicationArguments args) throws Exception {

}
}

I removed the "implements ApplicationRunner" and the run method (which were there due to a copy-paste mistake) and then it worked
Reply

#18
If you are using Java 9 JPMS it is not enough to add spring-boot-starter-web as a dependency, as tomcat-embed lib would not be available at runtime and spring boot will not detect the app as web app.

To fix this make tomcat embed available via following directive added to your module-info.java for *main app*

requires org.apache.tomcat.embed.core;
Reply

#19
In my case, the problem happened when I tried to insert 5000 records into database (it worked okay with fewer records)<br/>
What worked for me: Uncomment devtools dependency in pom.xml file:<br/>
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
```
Reply

#20
Here is how you can fix it:

Check if you don't have dependency on spring-boot-starter-web in your pom.xml file. To get you pom.xml file right, use this link start.spring.io

If you have above dependency, but still facing the issue, it is highly possible that your embedded tomcat jars are present. To confirm this, run maven build in debug mode -

mvn spring-boot:run --debug
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through