M.Ahsen Taqi M.Ahsen Taqi - 3 months ago 30
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

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 donot know what i am doing wrong

any help will be appreciated

Answer

remove the quotes

file.path=public/img/