M.Ahsen Taqi M.Ahsen Taqi -4 years ago 146
Scala Question

Exception while getting string from conf file in Play 2 with Scala

I am trying to get a file path from conf ,
this is my conf file



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)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246)

i am donot know what i am doing wrong

any help will be appreciated

Answer Source

remove the quotes

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download