[英]Exception in thread “main” java.lang.InstantiationException in scala akka microkernel
I've followed through this docs http://doc.akka.io/docs/akka/snapshot/scala/microkernel.html#microkernel-scala to make standalaone akka app using microkernel. 我已经按照此文档http://doc.akka.io/docs/akka/snapshot/scala/microkernel.html#microkernel-scala制作了使用微内核的Standalaone Akka应用程序。 I have fulfilled its dependecies and sbt plugins.
我已经实现了它的依赖和sbt插件。 Here's my main class :
这是我的主要课程:
package id.nolimit.platform.store.actor
import com.typesafe.config.ConfigFactory
import akka.actor.ActorSystem
import akka.actor.Props
import akka.routing.RoundRobinRouter
import akka.kernel.Bootable
object AppMainKernel extends Bootable{
val system = ActorSystem("PlatformStore", ConfigFactory.load().getConfig("RemoteSys"))
def startup = {
val storeActor = system.actorOf(Props(new StoreActor).withDispatcher("dispatcher").withRouter(RoundRobinRouter(nrOfInstances = 5)), name = "storeActor")
}
def shutdown = {
system.shutdown()
}
}
what's really happen with thread 'main' ? 线程“ main”到底发生了什么? Thank you :)
谢谢 :)
Change your AppMainKernal
from an object
to a class. 将您的
AppMainKernal
从object
更改为类。 The code that boots up your Bootable
is trying to instantiate it via reflection but can't because it's defined as an object
(singleton with non-visible constructor) and not a class
. Bootable
的代码试图通过反射实例化它,但是不能,因为它被定义为object
(具有不可见构造函数的单个object
)而不是class
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.