aclement/spring-boot-graal-feature

IllegalStateException when application.yml present

chrisjs opened this issue · 0 comments

when providing an application.yml, an IllegalStateException occurs on application startup

using GraalVM CE 19.0.2. the below diff can be applied to the commandLinerunner sample to reproduce:

diff --git a/samples/commandlinerunner/clr b/samples/commandlinerunner/clr
new file mode 100755
index 0000000..cc221b0
Binary files /dev/null and b/samples/commandlinerunner/clr differ
diff --git a/samples/commandlinerunner/src/main/resources/application.properties b/samples/commandlinerunner/src/main/resources/application.properties
deleted file mode 100644
index f85e7ff..0000000
--- a/samples/commandlinerunner/src/main/resources/application.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-spring.datasource.jmx-enabled=false
-logging.level.root=INFO
-
diff --git a/samples/commandlinerunner/src/main/resources/application.yml b/samples/commandlinerunner/src/main/resources/application.yml
new file mode 100644
index 0000000..5b51f05
--- /dev/null
+++ b/samples/commandlinerunner/src/main/resources/application.yml
@@ -0,0 +1,3 @@
+spring:
+  main:
+    banner-mode: "off"

which then on invocation of clr the following exception is produced:

SEVERE: Application run failed
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:577)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:523)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:490)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:471)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7(ConfigFileApplicationListener.java:470)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:467)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:341)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:213)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:196)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:183)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:350)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:309)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1275)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1263)
	at com.example.commandlinerunner.CommandlinerunnerApplication.main(CommandlinerunnerApplication.java:27)
Caused by: java.lang.IllegalStateException: Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath
	at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:47)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:595)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:549)
	... 23 more