当前位置 : 主页 > 手机开发 > 无线 >

避免akka终止webapp JVM进程

来源:互联网 收集:自由互联 发布时间:2021-06-10
当发生一些意外异常时,如何避免Akka终止JVM PROCESS?我认为这是一个大问题. Akka永远不应该杀死我的webapp的jvm进程. 我正在使用play framework 2.3. 使用案例: Uncaught error from thread [SuperActorS
当发生一些意外异常时,如何避免Akka终止JVM PROCESS?我认为这是一个大问题.

Akka永远不应该杀死我的webapp的jvm进程.

我正在使用play framework 2.3.

使用案例:

Uncaught error from thread [SuperActorSystem-akka.actor.default-dispatcher-5] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.ExceptionInInitializerError
    at actors.SMSSenderActor$$anonfun$receive$1.applyOrElse(SMSSenderActor.scala:40)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
    at actors.SMSSenderActor.aroundReceive(SMSSenderActor.scala:14)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
    at akka.actor.ActorCell.invoke(ActorCell.scala:487)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
    at akka.dispatch.Mailbox.run(Mailbox.scala:220)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:322)
    at scala.None$.get(Option.scala:320)
    at gcm.GCMUtil$.initializeCCS(GCMUtil.scala:15)
    at gcm.GCMUtil$.<init>(GCMUtil.scala:10)
    at gcm.GCMUtil$.<clinit>(GCMUtil.scala)
    ... 12 more


    at actors.SMSSenderActor.aroundReceive(SMSSenderActor.scala:14)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
    at akka.actor.ActorCell.invoke(ActorCell.scala:487)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
    at akka.dispatch.Mailbox.run(Mailbox.scala:220)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:322)
    at scala.None$.get(Option.scala:320)
    at gcm.GCMUtil$.initializeCCS(GCMUtil.scala:15)
    at gcm.GCMUtil$.<init>(GCMUtil.scala:10)
    at gcm.GCMUtil$.<clinit>(GCMUtil.scala)

谢谢.

解决方案是在我的playframework应用程序中将以下内容添加到我的application.conf中:

akka{  
    jvm-exit-on-fatal-error = off
}

这就是我可以在播放应用中覆盖akka的默认参数的方式.谢谢大家.

网友评论