1
votes

I had a couple of Spring Boot applications running in my workspace using STS IDE, and right after i did maven update on one of the projects every single one of them stops right after application boot process. I even created the smallest example just to start something and the same thing happens.

@SpringBootApplication
public class App implements CommandLineRunner {

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

 @Override
 public void run(String... arg0) throws Exception {
        System.out.println("Started...");

 }
}

This is my pom.xml

<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>sasa-test-app</groupId>
  <artifactId>sasa-app</artifactId>
  <version>1.0.0</version>
  <packaging>war</packaging>

    <name>sasa-app</name>
    <description>Sasa</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.BUILD-SNAPSHOT</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

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

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

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

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>

And this is what i get on application start. I tried every suggestion i could find online - i am missing something here.


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m[2m (v1.4.0.BUILD-SNAPSHOT)[0;39m

[2m2016-07-10 22:35:25.204[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[           main][0;39m [36msasa_test_app.sasa_app.App              [0;39m [2m:[0;39m Starting App on LAPTOP-C36O81UQ with PID 10028 (C:\Users\sasar\DEVCODE\STS_WORKSPACE\sasa-app\target\classes started by sasar in C:\Users\sasar\DEVCODE\STS_WORKSPACE\sasa-app)
[2m2016-07-10 22:35:25.210[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[           main][0;39m [36msasa_test_app.sasa_app.App              [0;39m [2m:[0;39m No active profile set, falling back to default profiles: default
[2m2016-07-10 22:35:25.426[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.c.a.AnnotationConfigApplicationContext[0;39m [2m:[0;39m Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@641147d0: startup date [Sun Jul 10 22:35:25 CEST 2016]; root of context hierarchy
[2m2016-07-10 22:35:29.004[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.j.e.a.AnnotationMBeanExporter       [0;39m [2m:[0;39m Registering beans for JMX exposure on startup
Started...
[2m2016-07-10 22:35:29.041[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[           main][0;39m [36msasa_test_app.sasa_app.App              [0;39m [2m:[0;39m Started App in 4.664 seconds (JVM running for 5.876)
[2m2016-07-10 22:35:29.070[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[       Thread-1][0;39m [36ms.c.a.AnnotationConfigApplicationContext[0;39m [2m:[0;39m Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@641147d0: startup date [Sun Jul 10 22:35:25 CEST 2016]; root of context hierarchy
[2m2016-07-10 22:35:29.075[0;39m [32m INFO[0;39m [35m10028[0;39m [2m---[0;39m [2m[       Thread-1][0;39m [36mo.s.j.e.a.AnnotationMBeanExporter       [0;39m [2m:[0;39m Unregistering JMX-exposed beans on shutdown


Even those Getting started examples stop right after boot. I would be very thankful for some help here.

edit: As Alexandru Marina stated in the comment, I was using SNAPSHOT instead of stable release.

2
Can you provide a link to the getting started samples you got? - Xtreme Biker
A side note only: is the version 1.4.0.BUILD-SNAPSHOT of the spring boot parent pom intended? If not, maybe you can try with a stable version also. - Alexandru Marina
@XtremeBiker I tried 6-7 starter samples (accessing mongodb data, hibernate, postgresql, mvc...), Actually, i switched back 1.3.6 STABLE and it got everything up and running. Thank you so much Alexandru Marina, what a rookie mistake. - Sasa Radovanovic
Just one question, what's the point of implementing commandlinerunner in a Web application? - Xtreme Biker

2 Answers

3
votes

i had a similar problem. I found a corrupt tomcat-embed-core-8.5.4 dependency in my local Maven cache. Please delete it and run your Maven build to retrieve the dependency again.

0
votes

Instead of CommandLineRunner implementation extend class SpringBootServletInitializer or better read here the documentation.