You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to load a default application config while running my project in Scala IDE. Everything works great if I run the application via sbt at the CLI, but when I try to start my application in Scala IDE using the Scala Application loader it's unable to find the configuration file.
I've placed my application configuration file in my project at the following path.
/src/main/resources/application.conf
My calling code is simply ConfigFactory.load().getString("bar") from my main method and I get the following stack trace.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.foo.dataservices.MyServer.main(MyServer.scala)
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'bar'
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:138)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
at com.typesafe.config.impl.SimpleConfig.getConfigNumber(SimpleConfig.java:170)
at com.typesafe.config.impl.SimpleConfig.getInt(SimpleConfig.java:181)
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
is it as simple as adding src/main/resources to the classpath? Eclipse has that hidden somewhere in some dialog (I'm not at my computer right now to look)
I added it to the Sources build path in Eclipse and it's working as expected. The solution was in a stackoverflow question I created a short while ago.
Hi,
I'm attempting to load a default application config while running my project in Scala IDE. Everything works great if I run the application via sbt at the CLI, but when I try to start my application in Scala IDE using the Scala Application loader it's unable to find the configuration file.
I've placed my application configuration file in my project at the following path.
/src/main/resources/application.conf
My calling code is simply ConfigFactory.load().getString("bar") from my main method and I get the following stack trace.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.foo.dataservices.MyServer.main(MyServer.scala)
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'bar'
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:138)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
at com.typesafe.config.impl.SimpleConfig.getConfigNumber(SimpleConfig.java:170)
at com.typesafe.config.impl.SimpleConfig.getInt(SimpleConfig.java:181)
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: