Service XYZ was not found by service locator

Hi guys,

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.

Any ideas?

Thanks,

Hi @lejoow,

That’s not enough to have a good picture of the problem. It will help if you share your config.

If you are using sbt-reactive-app, please also chare the rp-application.conf that is being generated in your target folder.

Btw, have you tried to deploy it locally on Minikube for instance? Does it work?

Hi Renato,

I was not able to deploy locally through minikube due to some strange errors, which I didn’t investigate too much.

We are using the following command to generate the k8s resources, I believe it means that we are using sbt-reactive-app. Am I right?

I couldn’t find the rp-application.conf file in the target folder. How do I find this?

rp generate-kubernetes-resources us.gcr.io/XXXXX-16XXX01/$s-impl:1.0.2-$XXXXXX
–generate-pod-controllers –generate-services
–env JAVA_OPTS=“-Dplay.http.secret.key=$secret_key”
–namespace silver-$ENV
–pod-controller-replicas 3
–external-service “cas_native=$service_cassandra”
–external-service “kafka_native=$service_kafka” > $DIR/$s.yml

Thanks,

I think I figured out why.

Here it says:

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?

How does it work exactly?

Thanks,

J

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.

Thanks for bringing that up. It seems that the documentation is not clear about it and needs to be improved. I have opened an issue to track it (https://github.com/lightbend/lightbend-orchestration-docs/issues/66).

1 Like