no configuration setting found for key akka

Rahul Dev picture Rahul Dev · Feb 6, 2015 · Viewed 15.6k times · Source

I am using scala, spray and akka for one of my projects. In Intellij, it is working fine. When I build the project and tried to run it in command line, I get the following error.


Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting
 found for key 'akka'
        at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:147)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:159)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:164)
        at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:206)
        at akka.actor.ActorSystem$Settings.(ActorSystem.scala:168)
        at akka.actor.ActorSystemImpl.(ActorSystem.scala:504)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:141)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:108)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:99)

Answer

BenjaminParker picture BenjaminParker · Jun 8, 2015

The problem is when using sbt:assembly the default merge strategy excludes all the reference.conf files as per

If multiple files share the same relative path (e.g. a resource named application.conf in multiple dependency JARs), the default strategy is to verify that all candidates have the same contents and error out otherwise.

The solution is to add a MergeStrategy as follows

assemblyMergeStrategy in assembly := {
  case PathList("reference.conf") => MergeStrategy.concat
}