Lagom Service entering infitive loop when exception occurs


(Bahtiyar Erden) #1

Hello guys,

My lagom service entering infitive loop when exception occurs. But i throw this exception on entity level and handle this exception on service level and returning as a BadRequest.

com.lightbend.lagom.scaladsl.api.transport.BadRequest: User does not exists
	atcom.lightbend.lagom.scaladsl.api.transport.BadRequest$.apply(Exceptions.scala:393)	at 
com.venndom.utils.exception.ExceptionUtils$.throwBadRequest(ExceptionUtils.scala:49)
	at com.venndom.utils.exception.ExceptionUtils$.handleException(ExceptionUtils.scala:30)
	at com.venndom.myservice.impl.MyServiceImpl$$anonfun$$nestedInanonfun$getServiceMethod$1$1.applyOrElse(MyServiceImpl.scala:501)
	at com.venndom.myservice.impl.MyServiceImpl$$anonfun$$nestedInanonfun$getServiceMethod$1$1.applyOrElse(MyServiceImpl.scala:501)
	at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:34)
	at scala.util.Failure.recover(Try.scala:230)
	at scala.concurrent.Future.$anonfun$recover$1(Future.scala:391)
	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)
2018-09-29 11:37:23,793 [INFO] application - Received GET /api/foo/a65ec77f-14d1-40f0-8c0b-45cc5d656abc/foo2/acd09322-04ef-4ea4-a778-2c3911062d78/ from address 100.96.4.124, took 2ms and returned 400

(Alan Klikic) #2

@bahtiyarerden i do not understand from your post where do you get the infinite loop?
Can you share command handler and service implementation code?