Spring Boot Samples FileNot发现错误 [英] Spring Boot Samples FileNot found error

查看:187
本文介绍了Spring Boot Samples FileNot发现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是关于春季启动项目的例子。
我已经通过maven编译并创建了一个jar文件,但在运行尝试时出错。



,当您尝试从jar文件运行应用程序时,会导致Windows上的类加载出现问题。我建议回到1.1.1直到它被修复。


I am folowing the examples about spring boot project. I have compiled and created a jar file via maven but having an error while running attempt.

https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple

Project folders:

Error:

java -jar spring-boot-sample-simple-1.1.3.BUILD-SNAPSHOT.jar

014-06-25 09:10:00.653 ERROR 12028 --- [           main] o.s.boot.SpringApplication               : Application startup failed

ava.lang.IllegalStateException: Unable to load configuration files
       at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:158)
       at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.j
va:138)
       at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.j
va:131)
       at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:120)
       at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
       at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
       at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:59)
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:277)
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:944)
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:933)
       at sample.simple.SampleSimpleApplication.main(SampleSimpleApplication.java:46)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
       at java.lang.Thread.run(Unknown Source)
aused by: java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist
       at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
       at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:132)
       at org.springframework.core.io.support.PropertiesLoaderUtils.loadProperties(PropertiesLoaderUtils.java:121)
       at org.springframework.boot.env.PropertiesPropertySourceLoader.load(PropertiesPropertySourceLoader.java:44)
       at org.springframework.boot.env.PropertySourcesLoader.load(PropertySourcesLoader.java:126)
       at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadIntoGroup(ConfigFileApplicationListener.java:360)
       at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:349)
       at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:317)
       at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:155)
       ... 16 common frames omitted

解决方案

There's a bug in Spring Boot 1.1.2 that causes some problems with class loading on Windows when you try to run your app from a jar file. I'd recommend dropping back to 1.1.1 until it's fixed.

这篇关于Spring Boot Samples FileNot发现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆