I have been getting this error everytime my service A tries to call service B:
java.lang.IllegalStateException: Service B was not found by service locator at com.lightbend.lagom.internal.client.ClientServiceCallInvoker.$anonfun$doInvoke$4(ClientServiceCallInvoker.scala:75) at scala.util.Success.$anonfun$map$1(Try.scala:251) at scala.util.Success.map(Try.scala:209) at scala.concurrent.Future.$anonfun$map$1(Future.scala:288) at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29) at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
I am deploying my Lagom application to the Google Cloud Kubernetes using the Lightbend’s Orchestration platform.
I tried re-deploying both service A and B many times, clean up the Cassandra database and many other things but no luck yet.
A third method, describeService , is optional, but may be used by tooling, for example by Lightbend Orchestration, to discover what service APIs are offered by this service. The metadata read from here may in turn be used to configure service gateways and other components.
My Service Application Loader, previously was missing the describeService method.
So previously my loader was:
class InstrumentApplicationLoader extends LagomApplicationLoader {
override def load(context: LagomApplicationContext): LagomApplication =
new InstrumentApplication(context) with LagomServiceLocatorComponents
}
And now:
class InstrumentApplicationLoader extends LagomApplicationLoader {
override def loadDevMode(context: LagomApplicationContext): LagomApplication =
new InstrumentApplication(context) with LagomDevModeComponents
override def load(context: LagomApplicationContext): LagomApplication =
new InstrumentApplication(context) with LagomServiceLocatorComponents
override def describeService = Some(readDescriptor[InstrumentService])
}
And now the service can find each other it seems.
So am I right to say, this third method describeService is NOT OPTIONAL but it is mandatory when you are using Lightbend Orchestration (such as rp tool) for deployment?
describeService is also optional when using Lightbend Orchestration, but in case you don’t use it you need to explicitly set the appName in the sbt config.