This sounds like, which has been fixed in Spark 1.4+ and in branch-1.3 (for Spark 1.3.2).

On Wed, Jun 24, 2015 at 10:57 PM, Niranda Perera <> wrote:
Hi all, 

I'm trying to implement a custom StandaloneRecoveryModeFactory in the Java environment. Pls find the implementation here. [1] . I'm new to Scala, hence I'm trying to use Java environment as much as possible. 

when I start a master with spark.deploy.recoveryMode.factory property to be "CUSTOM", I encounter a NoSuchMethodException for my custom class's constructor. 
it has the following constructor.

 public AnalyticsStandaloneRecoveryModeFactory(SparkConf conf, Serialization serializer)

but from the Master, it looks for a constructor for,<init>(org.apache.spark.SparkConf, akka.serialization.Serialization$)

I see in the Spark source code for Master, that it uses reflection to get the custom recovery mode factory class. 

case "CUSTOM" =>
        val clazz = Class.forName(conf.get("spark.deploy.recoveryMode.factory"))
        val factory = clazz.getConstructor(conf.getClass, Serialization.getClass)
          .newInstance(conf, SerializationExtension(context.system))
        (factory.createPersistenceEngine(), factory.createLeaderElectionAgent(this))

here, Serialization.getClass returns a akka.serialization.Serialization$ object, where as my custom class's constructor accepts akka.serialization.Serialization object. 

so I would like to know, 
1. if this happens because I'm using this in the Java environment?
2. what is the workaround to this? 


Please find the full stack trace of the error below. 

[2015-06-25 10:59:01,095] ERROR {} -<init>(org.apache.spark.SparkConf, akka.serialization.Serialization$) exception during creation
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(
Caused by: java.lang.NoSuchMethodException:<init>(org.apache.spark.SparkConf, akka.serialization.Serialization$)
at java.lang.Class.getConstructor0(
at java.lang.Class.getConstructor(
at org.apache.spark.deploy.master.Master.preStart(Master.scala:165)
at org.apache.spark.deploy.master.Master.aroundPreStart(Master.scala:52)
... 9 more