Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing default application.config from resources using Scala IDE #54

Closed
seglo opened this issue Dec 27, 2012 · 2 comments
Closed

Accessing default application.config from resources using Scala IDE #54

seglo opened this issue Dec 27, 2012 · 2 comments

Comments

@seglo
Copy link

seglo commented Dec 27, 2012

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.

@havocp
Copy link
Collaborator

havocp commented Dec 27, 2012

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)

@seglo
Copy link
Author

seglo commented Dec 27, 2012

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.

http://stackoverflow.com/questions/14060131/access-configuration-resources-in-scala-ide

@seglo seglo closed this as completed Dec 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants