【问题标题】:Spring application shutting down immediatelySpring应用程序立即关闭
【发布时间】:2019-01-27 08:45:26
【问题描述】:

我刚开始学习 Spring,所以我通过将 Spring-boot 版本设置为 2.0.4、Java 版本设置为 10 并添加 Web 作为依赖项,从 https://start.spring.io/ 获得了一个样板的 spring-boot 项目。我使用 STS-3.9.5.RELEASE 作为我的 ide。我将这个项目作为一个 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)

【问题讨论】:

  • 你试过用 Java 8 代替吗?
  • 我在 java 8 上也得到了相同的输出
  • 请粘贴更多日志
  • 删除本地缓存并开启校验和策略...
  • 这么简单的事情怎么能错过。这确实有效!谢谢!

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


【解决方案1】:

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

mvn clean install -U

强制重新加载?

【讨论】:

    猜你喜欢
    • 2020-09-22
    • 2017-01-14
    • 1970-01-01
    • 2019-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多