Spring应用程序立即关闭

时间:2018-08-21 07:48:18

标签: maven spring-boot spring-tool-suite

我刚刚开始学习Spring,所以我通过将Spring-boot版本设置为2.0.4,将Java版本设置为10并添加了Web作为依赖项,从https://start.spring.io/得到了一个样板的spring-boot项目。我正在使用STS-3.9.5.RELEASE作为我的助手。我将这个项目作为Java应用程序运行,这是我得到的控制台输出,

2018-08-21 13:04:55.009  INFO 8352 --- [           main] com.globalmatics.bike.BikeApplication    : Starting BikeApplication on LAPTOP-MO8TLAE6 with PID 8352 (D:\Education\spring-tool-suite-3.9.5.RELEASE-e4.8.0-win32-x86_64\workspace\bike\demo\target\classes started by Rajesh Raghunathan in D:\Education\spring-tool-suite-3.9.5.RELEASE-e4.8.0-win32-x86_64\workspace\bike\demo)
2018-08-21 13:04:55.014  INFO 8352 --- [           main] com.globalmatics.bike.BikeApplication    : No active profile set, falling back to default profiles: default
2018-08-21 13:04:55.062  INFO 8352 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6f10d5b6: startup date [Tue Aug 21 13:04:55 IST 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/Rajesh%20Raghunathan/.m2/repository/org/springframework/spring-core/5.0.8.RELEASE/spring-core-5.0.8.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-08-21 13:04:55.938  INFO 8352 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-08-21 13:04:55.952  INFO 8352 --- [           main] com.globalmatics.bike.BikeApplication    : Started BikeApplication in 1.229 seconds (JVM running for 1.598)
2018-08-21 13:04:55.955  INFO 8352 --- [       Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6f10d5b6: startup date [Tue Aug 21 13:04:55 IST 2018]; root of context hierarchy
2018-08-21 13:04:55.957  INFO 8352 --- [       Thread-1] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

我检查了pom,发现它具有spring-boot-starter-web依赖项,我知道该依赖项可以启动Tomcat服务器,但不确定为什么它不起作用。

编辑:我再次下载了该项目,并运行了mvn clean install命令,并直接通过powershell运行了jar。仍然出现相同的错误。但是,这次我注意到此控制台输出,

[ERROR] error reading C:\Users\Rajesh Raghunathan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.32\tomcat-embed-core-8.5.32.jar; ZipFile invalid LOC header (bad signature)

1 个答案:

答案 0 :(得分:1)

看来您的文件tomcat-embed-core-8.5.32.jar实际上已损坏。 尝试

mvn clean install -U

强制重新加载?