javamultithreadingscalaakkamicrokernel

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. I have fulfilled its dependecies and sbt plugins. 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' ? Thank you :)


Solution

  • Change your AppMainKernal from an object to a class. 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.