Reputation: 965
I am trying to get a file path from conf, this is my conf file:
uploadedFilePath.conf
file.path="public/img/"
This is how I am getting path from conf file in my code:
val conf = ConfigFactory.load()
var path : String = conf.getString("file.path")
I am getting exception on second line
09:58:11.527 108649 [application-akka.actor.default-dispatcher-10] PlayDefaultUpstreamHandler ERROR - Cannot invoke the action com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159) ~[com.typesafe.config-1.3.0.jar:na] at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170) ~[com.typesafe.config-1.3.0.jar:na] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184) ~[com.typesafe.config-1.3.0.jar:na] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189) ~[com.typesafe.config-1.3.0.jar:na] at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246) ~[com.typesafe.config-1.3.0.jar:na]
I am do not know what I am doing wrong.
Upvotes: 1
Views: 1351