Lagom: Incorrect Akka Discovery method configured for actor system in Lagom Dev mode

Created on 8 Apr 2019  Â·  3Comments  Â·  Source: lagom/lagom

Lagom Version

master
1.5.0-RC2

API

Both

Operating System

MacOS 10.14.3

JDK

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Expected Behavior

When starting a Lagom project in Dev mode with a gRPC client configured to use the default service discovery of the actor system as shown in the lagom-scala-grpc-example the DevModeServiceDiscovery of Lagom should be used to resolve the address of the gRPC server.

Actual Behavior

When starting the project with the runAll task the following exception is thrown:

java.lang.IllegalArgumentException: akka.discovery.com.lightbend.lagom.internal.registry.DevModeSimpleServiceDiscovery.class must contain field "class" that is a FQN of a "akka.discovery.ServiceDiscovery" implementation
        at akka.discovery.Discovery.classNameFromConfig$1(Discovery.scala:66)
        at akka.discovery.Discovery.akka$discovery$Discovery$$createServiceDiscovery(Discovery.scala:82)
        at akka.discovery.Discovery$$anon$1.apply(Discovery.scala:21)
        at akka.discovery.Discovery$$anon$1.apply(Discovery.scala:20)
        at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
        at akka.discovery.Discovery.loadServiceDiscovery(Discovery.scala:51)
        at akka.discovery.Discovery.defaultImpl$lzycompute(Discovery.scala:34)
        at akka.discovery.Discovery.defaultImpl(Discovery.scala:34)
        at akka.discovery.Discovery.discovery(Discovery.scala:40)
        at akka.grpc.GrpcClientSettings$.usingServiceDiscovery(GrpcClientSettings.scala:67)
        at com.example.helloproxy.impl.HelloProxyApplication.settings$lzycompute(HelloProxyLoader.scala:45)
        at com.example.helloproxy.impl.HelloProxyApplication.settings(HelloProxyLoader.scala:44)
        at com.example.helloproxy.impl.HelloProxyApplication.greeterServiceClient$lzycompute(HelloProxyLoader.scala:53)
        at com.example.helloproxy.impl.HelloProxyApplication.greeterServiceClient(HelloProxyLoader.scala:53)
        at com.example.helloproxy.impl.HelloProxyApplication.$anonfun$lagomServer$1(HelloProxyLoader.scala:63)
        at com.lightbend.lagom.scaladsl.server.LagomServiceBinder$$anon$6$$anon$7.service$lzycompute(LagomServer.scala:182)
        at com.lightbend.lagom.scaladsl.server.LagomServiceBinder$$anon$6$$anon$7.service(LagomServer.scala:182)
        at com.lightbend.lagom.scaladsl.server.LagomServiceBinder$$anon$6$$anon$7.router$lzycompute(LagomServer.scala:181)
        at com.lightbend.lagom.scaladsl.server.LagomServiceBinder$$anon$6$$anon$7.router(LagomServer.scala:181)
        at com.lightbend.lagom.scaladsl.server.LagomServer$$anon$5.router$lzycompute(LagomServer.scala:121)
        at com.lightbend.lagom.scaladsl.server.LagomServer$$anon$5.router(LagomServer.scala:121)
        at com.lightbend.lagom.scaladsl.server.LagomServerComponents.router(LagomServer.scala:154)
        at com.lightbend.lagom.scaladsl.server.LagomServerComponents.router$(LagomServer.scala:154)
        at com.lightbend.lagom.scaladsl.server.LagomApplication.router$lzycompute(LagomApplicationLoader.scala:227)
        at com.lightbend.lagom.scaladsl.server.LagomApplication.router(LagomApplicationLoader.scala:227)
        at play.api.BuiltInComponents.httpRequestHandler(Application.scala:365)
        at play.api.BuiltInComponents.httpRequestHandler$(Application.scala:362)
        at play.api.BuiltInComponentsFromContext.httpRequestHandler$lzycompute(ApplicationLoader.scala:201)
        at play.api.BuiltInComponentsFromContext.httpRequestHandler(ApplicationLoader.scala:201)
        at play.api.BuiltInComponents.application(Application.scala:371)
        at play.api.BuiltInComponents.application$(Application.scala:370)
        at play.api.BuiltInComponentsFromContext.application$lzycompute(ApplicationLoader.scala:201)
        at play.api.BuiltInComponentsFromContext.application(ApplicationLoader.scala:201)
        at com.lightbend.lagom.scaladsl.server.LagomApplicationLoader.load(LagomApplicationLoader.scala:76)
        at play.core.server.LagomReloadableDevServerStart$$anon$1.$anonfun$get$4(LagomReloadableDevServerStart.scala:196)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
        at play.core.server.LagomReloadableDevServerStart$$anon$1.$anonfun$get$2(LagomReloadableDevServerStart.scala:189)
        at scala.Option.map(Option.scala:163)
        at play.core.server.LagomReloadableDevServerStart$$anon$1.$anonfun$get$1(LagomReloadableDevServerStart.scala:165)
        at scala.util.Success.flatMap(Try.scala:251)
        at play.core.server.LagomReloadableDevServerStart$$anon$1.get(LagomReloadableDevServerStart.scala:163)
        at play.core.server.Server.reload(Server.scala:40)
        at play.core.server.Server.reload$(Server.scala:40)
        at play.core.server.AkkaHttpServer.reload(AkkaHttpServer.scala:47)
        at com.lightbend.lagom.dev.Reloader$$anon$2.reload(Reloader.scala:139)
        at com.lightbend.lagom.sbt.LagomReloadableService$.$anonfun$projectSettings$24(LagomPlugin.scala:236)
        at com.lightbend.lagom.dev.Reloader.$anonfun$quietPeriodFinished$1(Reloader.scala:284)
        at com.lightbend.lagom.dev.Reloader.$anonfun$quietPeriodFinished$1$adapted(Reloader.scala:284)
        at scala.collection.Iterator.foreach(Iterator.scala:937)
        at scala.collection.Iterator.foreach$(Iterator.scala:937)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
        at com.lightbend.lagom.dev.Reloader.com$lightbend$lagom$dev$Reloader$$quietPeriodFinished(Reloader.scala:284)
        at com.lightbend.lagom.dev.Reloader$$anon$5.run(Reloader.scala:275)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

Cause

The current actor system config applied in Lagom Dev mode is configured to use the following Akka Discovery method in LagomConfig:
https://github.com/lagom/lagom/blob/9b050f32b38ece1d00d22f0ded442e7c6032a4de/dev/build-tool-support/src/main/scala/com/lightbend/lagom/dev/LagomConfig.scala#L27

With usage of the new Akka Discovery mechanism introduced in https://github.com/lagom/lagom/commit/7b6b50ff1e7955f5b16836b4c80a13bf2a13c2c8 the registered name of the DevModeServiceDiscovery was changed from the class name
com.lightbend.lagom.internal.registry.DevModeSimpleServiceDiscovery
https://github.com/lagom/lagom/blob/454ecfcea53fdf63e203b412c1354b4d9a2144f6/dev/service-registry/client-core/src/main/scala/com/lightbend/lagom/internal/registry/DevModeSimpleServiceDiscovery.scala#L37
to lagom-dev-mode
https://github.com/lagom/lagom/blob/9b050f32b38ece1d00d22f0ded442e7c6032a4de/dev/service-registry/client-core/src/main/scala/com/lightbend/lagom/internal/registry/DevModeServiceDiscovery.scala#L44
so the setting in LagomConfig should be adapted accordingly for the DevModeServiceDiscovery to be found.

I could provide a fix for this but I am not quite sure how to test this properly.

Most helpful comment

Thanks @cstub for reporting this.

That's indeed a bug. I will fix it as soon as possible.

You can workaround this by adding the following settings to the sbt project that is using Akka Discovery.

// workaround for akka discovery method lookup in dev-mode
lagomDevSettings := Seq("akka.discovery.method" -> "lagom-dev-mode")

All 3 comments

I am having similar issue with akka 2.5.22 version of akka-discovery.
Is there going to be a fix

Thanks @cstub for reporting this.

That's indeed a bug. I will fix it as soon as possible.

You can workaround this by adding the following settings to the sbt project that is using Akka Discovery.

// workaround for akka discovery method lookup in dev-mode
lagomDevSettings := Seq("akka.discovery.method" -> "lagom-dev-mode")

Thanks

Chandra Keerthy


From: Renato Cavalcanti notifications@github.com
Sent: Wednesday, May 22, 2019 5:08:56 AM
To: lagom/lagom
Cc: Chandra Keerthy; Comment
Subject: Re: [lagom/lagom] Incorrect Akka Discovery method configured for actor system in Lagom Dev mode (#1857)

Thanks @cstubhttps://github.com/cstub for reporting this.

That's indeed a bug. I will fix it as soon as possible.

You can workaround this by adding the following settings to the sbt project that is using Akka Discovery.

// workaround for akka discovery method lookup in dev-mode
lagomDevSettings := Seq("akka.discovery.method" -> "lagom-dev-mode")

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/lagom/lagom/issues/1857?email_source=notifications&email_token=AGG5B2YEILZBB3BWCH46AZLPWUESRA5CNFSM4HEMB5EKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV6NIEQ#issuecomment-494720018, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGG5B2ZOEJ3NALERPZRBY3LPWUESRANCNFSM4HEMB5EA.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jroper picture jroper  Â·  7Comments

ignasi35 picture ignasi35  Â·  6Comments

ignasi35 picture ignasi35  Â·  6Comments

TimMoore picture TimMoore  Â·  7Comments

coco1979ka picture coco1979ka  Â·  8Comments