0

[I am re-editing this question to reflect on my last tests]

I am trying to upgrade my akka / play 2.3 application from

"org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play23"

to

"org.reactivemongo" %% "play2-reactivemongo" % "0.11.11-play23"

Compilation goes fine but at run-time I get the following error:

[ERROR] -- NettyTransport(akka://reactivemongo)
failed to bind to /127.0.0.1:2552, shutting down Netty transport

...

Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:2552

The Akka part of application.conf reads as follows:

akka {
    loggers = ["akka.event.slf4j.Slf4jLogger"]
    loglevel = "DEBUG"
    actor {
        provider = "akka.remote.RemoteActorRefProvider"
        mailbox {
            requirements {
                "akka.dispatch.BoundedMessageQueueSemantics" = bounded-mailbox
            }
        }
    }
    remote {
        enabled-transports = ["akka.remote.netty.tcp"]
        netty.tcp {
            hostname = "127.0.0.1"
            port = 2552
        }
    }
}

The exception is raised when trying to instantiate the reactivemongo driver

val driver = new reactivemongo.api.MongoDriver()

This suggests that the mongodriver is using Akka under the hood and is binding to the same address that my main application. And indeed, if I edit my application.conf and change the akka.remote.netty.tcp.port from 2552 to 2553, I get the following exception:

[ERROR] -- NettyTransport(akka://reactivemongo)
failed to bind to /127.0.0.1:2553, shutting down Netty transport

In the previous versions of reactivemongo, by default, instantiating the driver was starting a new actor system so maybe version 0.11.11 tries to reuse the existing system?

I have tried to modify the akka port used by the driver as follows:

val customConf = ConfigFactory.parseString("""
  akka {
    remote {
      netty.tcp.port = 4711
    }
  }
  """)

val typesafeConfig: com.typesafe.config.Config = ConfigFactory.load(customConf)

val driver = new reactivemongo.api.MongoDriver(Some(typesafeConfig))

But this does not work, the new port is not taken into account and I keep getting the same error:

[ERROR] -- NettyTransport(akka://reactivemongo)
failed to bind to /127.0.0.1:2552, shutting down Netty transport
david
  • 309
  • 1
  • 4
  • 15

1 Answers1

0

Actually, ReactiveMongo loads its configuration from the key 'mongo-async-driver'. So, Adding the following permits to configure ReactiveMongo underlying akka system:

val customConf = ConfigFactory.parseString("""
  mongo-async-driver {
    akka {
      loglevel = WARNING
      remote {
        enabled-transports = ["akka.remote.netty.tcp"]
        netty.tcp {
          hostname = "127.0.0.1"
          port = 4711
        }
      }
    }
  }
  """)
david
  • 309
  • 1
  • 4
  • 15