1

I've read up everything I could on SO and the ReactiveMongo community list and I am stumped. I am using ReactiveMongo version 0.12 and am just trying to test it out since I have some other problems.

The code in my scala worksheet is:

import reactivemongo.api.{DefaultDB, MongoConnection, MongoDriver}
import reactivemongo.bson.{
BSONDocumentWriter, BSONDocumentReader, Macros, document
}
import com.typesafe.config.{Config, ConfigFactory}

lazy val conf = ConfigFactory.load()

val driver1 = new reactivemongo.api.MongoDriver

val connection3 = driver1.connection(List("localhost"))

and the error I get is

[NGSession 3: 127.0.0.1: compile-server] INFO reactivemongo.api.MongoDriver - No mongo-async-driver configuration found
com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'
    at com.typesafe.config.impl.SimpleConfig.findKey(testMongo.sc:120)
    at com.typesafe.config.impl.SimpleConfig.find(testMongo.sc:143)
    at com.typesafe.config.impl.SimpleConfig.find(testMongo.sc:155)
    at com.typesafe.config.impl.SimpleConfig.find(testMongo.sc:160)
    at com.typesafe.config.impl.SimpleConfig.getString(testMongo.sc:202)
    at akka.actor.ActorSystem$Settings.<init>(testMongo.sc:165)
    at akka.actor.ActorSystemImpl.<init>(testMongo.sc:501)
    at akka.actor.ActorSystem$.apply(testMongo.sc:138)
    at reactivemongo.api.MongoDriver.<init>(testMongo.sc:879)
    at #worksheet#.driver1$lzycompute(testMongo.sc:9)
    at #worksheet#.driver1(testMongo.sc:9)
    at #worksheet#.get$$instance$$driver1(testMongo.sc:9)
    at #worksheet#.#worksheet#(testMongo.sc:30)

My application.conf is in src/main/resources of the sub-project which this worksheet is found and contains this:

mongo-async-driver {
  akka {
    loglevel = WARNING
    }
}

I added the ConfigFactory precisely because I got this error and thought it might help. I looked at the code and that's what ReactiveMongo is doing at this point so I thought perhaps a call here would force it to load at this point. I have moved the application.conf file into every conceivable place including a conf directory (thinking it might require play conventions) and the src/main/resources of the top level directory. Nothing works. So my first question is what am I doing wrong? Where should application.conf file go?

This info message causes my program to crash and driver doesn't get created so I can't move on from here.

Also, I added an akka key to reference.conf just in case - that didnt help either.

4
  • Try by yourself, in your code, to get mongo-async-driver.akka.loglevel from conf ... if not found, the resource layout is not ok
    – cchantep
    Oct 28, 2016 at 15:17
  • 1
    Would you be open to not running this in a worksheet? I am a bit on the skeptical side but sometimes I found issues in a worksheet that went away outside. It looks like you have some sort of application so I don't know if you can move your existing logic into your main application? Otherwise you can always comment it out and create a basic main that outputs this and see where that gets you
    – Barry
    Oct 28, 2016 at 15:18
  • Thanks for the suggestions. I ended up dropping ReactiveMongo and moving to the MongoDB Native Scala driver. Besides the fact that I know it will always track the latest version of MongoDB it's just MUCH easier to use, it is better documented, and I can get support from other vendors. I even got Microsoft to help me get it to work with Azure DocumentDB something they would never do with ReactiveMongo. I'm sure there are use cases where ReactiveMongo might be better but not for our projects thus far.
    – Aron T
    Dec 22, 2016 at 1:02
  • I have a similar question and finally, I found out the cause is sbt version. When I used sbt 1.x, I always got an error message No configuration setting found for key 'akka'. As long as I downgraded sbt version to 0.13.16, everything is OK. I guess that reactivemongo uses older AKKA libraries...
    – pandaforme
    Jan 11, 2018 at 3:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.