Why does Spring Boot web app close immediately after starting?

后端 未结 10 2322
南笙
南笙 2021-02-18 15:57

Using STS, if I import the \"Rest Service\" Getting Started project using the latest Spring Boot and choose \"Run As Spring Boot App\", it starts up, t

10条回答
  •  北恋
    北恋 (楼主)
    2021-02-18 16:44

    I had the same issue where my spring-boot app shuts down immediately without any trace of tomcat being started up although I had the dependency spring-boot-starter-web included in my pom.xml. This indicates that spring-boot isn't recognizing my app as a web application.

    Tried cleaning up and packaging my app again using mvn clean install utilities to verify if tomcat libraries are getting packaged into my app binary/deployable. Found the following issue (look for line starting with '[WARNING]'):

    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ exam-launcher ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 2 source files to C:\XXXXX\XXXXXX\XXXX_Workspace\my-app\target\classes
    [WARNING] error reading c:\.m2\org\apache\tomcat\embed\tomcat-embed-core\8.5.14\tomcat-embed-core-8.5.14.jar; invalid LOC header (bad signature)
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ exam-launcher ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Chaithu\Work_Related\Eclipse_Neon_Workspace\exam-portal-server\src\test\resources
    

    The tomcat library I had on my local repo got corrupted (for some unknown reasons) because of which it wasn't getting included in the maven package. Deleted the corresponding folder from my local maven repo and let maven download it freshly. And it works like a charm now !!

提交回复
热议问题