Struggling with "No configuration setting found for key 'akka'"

2,812 views
Skip to first unread message

Yadu Krishnan

unread,
Mar 11, 2021, 4:15:21 PM3/11/21
to ReactiveMongo - http://reactivemongo.org
I am struggling with one issue for a couple of weeks. I am trying to do a simple example with reactivemongo operations. I am able to run the tests successfully in my IntelliJ IDEA. 
However, when I run `sbt test` the test is failing with the below error:

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:156)
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:149)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:176)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:188)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:193)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:250)
at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:329)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:703)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:258)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:302)
at reactivemongo.api.AsyncDriver.<init>(AsyncDriver.scala:75)
at reactivemongo.api.AsyncDriver$.apply(AsyncDriver.scala:498)


I have tried a lot of google search, but could not find the solution. I have tried copying the entire reference.conf from akka into my test resources, but still no use. I understand that somehow the application.conf is getting overwritten and losing the configs, but have no idea what to do to solve this.

Note: It is a multi module sbt project, with different akka versions in some of the modules. 

Could anyone guide me with this? I am really struggling, and not sure what to do next. I am not posting the code since I doubt it is to do with the code as the tests pass in intelliJ, but fail in sbt.  

Cédric Chantepie

unread,
Mar 12, 2021, 2:35:23 AM3/12/21
to ReactiveMongo - http://reactivemongo.org
First, make sure there is nothing specific in the sources/build for your idea. Generally speaking, SBT is right and IDEs are wrong about compilation.
Then, ReactiveMongo is compatible with Akka from 2.3 to 2.6.
Finally, try to share a reproducer (code).

Yadu Krishnan

unread,
Mar 12, 2021, 2:51:25 AM3/12/21
to ReactiveMongo - http://reactivemongo.org
Hey, Thanks for the quick reply. 

I forgot to mention the versions. Let me share them first.

reactiveMongo = "1.0.3"
akka = "2.5.25", and 2.6.x transitively from another dependency.

The project is a multi module one, with other libraries as well. If I create a separate project(just for reactivemongo example), it is working fine. So, I suspect it has something to do with overriding the reference/application conf files. So, I tried adding the same application conf to the test/resources directory, but it still fails with the config issue.

However, I will try to reproduce it and share the link so that it can give more context. 

Yadu Krishnan

unread,
Mar 16, 2021, 5:39:07 PM3/16/21
to ReactiveMongo - http://reactivemongo.org
I am able to reproduce the issue in an individual project. I have pushed it to GitHub at https://github.com/yadavan88/reactive-mongo-test

After compile, just need to run sbt test. It will fail with

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'

Cédric Chantepie

unread,
Mar 17, 2021, 2:16:09 PM3/17/21
to ReactiveMongo - http://reactivemongo.org
I don't think that's something specific to the driver.
The ActorSystem (used by the driver, but could be any system) is in the reproducer inited through the assignation of a lazy val that can be accessed by multiple test thread ... and it trigger a classloader/concurrence issue.
Use a plain/eager val for the AsyncDriver() and it works.

Carlos Saltos

unread,
Mar 17, 2021, 2:58:06 PM3/17/21
to reacti...@googlegroups.com
At Talenteca we also have a multiproject repo and after couple of try and error configurations we come to this one:

"org.reactivemongo" %% "reactivemongo" % "1.0.0"
"com.typesafe.akka" %% "akka-slf4j" % "2.6.10"

Also we added the application.conf Akka configuration file to our common base project resources ... you may also copy the same application.conf to all the sub projects resources directory and will have more or less the same effect.

Here the file:

akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
logger-startup-timeout = "30s"
}

mongo-async-driver {
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
logger-startup-timeout = "30s"
}
}

You can obviously have a different configuration file (like another one slightly different for tests by instance) and also you may move back and forth with the versions by Akka and ReactiveMongo should be kept in synchronization.

For checking which ReactiveMongo version works with which Akka version you may visit https://mvnrepository.com/artifact/org.reactivemongo/reactivemongo and check de dependencies section for Akka compatible versions.

We also added ReactiveMongo shaded native but that's more for performance, but just in case here it is:

For Linux:
"org.reactivemongo" % "reactivemongo-shaded-native" % s"1.0-linux-x86-64"

For Mac:
"org.reactivemongo" % "reactivemongo-shaded-native" % s"1.0-osx-x86-64"

But again, that's more for performance reasons.

As Cédric mentioned, a repo with some reproducible code would be nice to try to help further.

Best regards,

Carlos Saltos
--
You received this message because you are subscribed to the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reactivemong...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reactivemongo/905af480-0d7c-4a88-8207-f1756385c5ebn%40googlegroups.com.

Yadu Krishnan

unread,
Mar 17, 2021, 3:21:00 PM3/17/21
to ReactiveMongo - http://reactivemongo.org
@cedric, Thanks very much, that was really helpful. I was stuck with it for more than 2 days, didn't think to check without lazy val!

@carlos, Thanks for the detailed info as well. It is now working after removing the *lazy* from driver creation

Really appreciate both of your help, thanks a ton!
Reply all
Reply to author
Forward
0 new messages