title: Spark runtime error: spark.metrics.sink.MetricsServlet cannot be instantialized
body: <p>I got invocation target exception when running project with spark 1.3 lib in maven in IntelliJ. </p>
  
  <p>I got met this error only in IntelliJ IDE. After I deployed the jar and ran via spark-submit, the error went out.  </p>
  
  <p>Any one has met with the same problem before? I hope to fix this problem so as to do easy-debugging. otherwise I have to package the jar every time when I want to run the code.   </p>
  
  <p>details are as below: </p>
  
  <pre><code>    2015-04-21 09:39:13 ERROR MetricsSystem:75 - Sink class org.apache.spark.metrics.sink.MetricsServlet cannot be instantialized
      2015-04-21 09:39:13 ERROR TrainingSFERunner:144 - java.lang.reflect.InvocationTargetException
      2015-04-20 16:08:44 INFO  BlockManagerMaster:59 - Registered BlockManager
      Exception in thread "main" java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
          at org.apache.spark.metrics.MetricsSystem$$anonfun$registerSinks$1.apply(MetricsSystem.scala:187)
          at org.apache.spark.metrics.MetricsSystem$$anonfun$registerSinks$1.apply(MetricsSystem.scala:181)
          at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
          at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
          at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226)
          at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
          at scala.collection.mutable.HashMap.foreach(HashMap.scala:98)
          at org.apache.spark.metrics.MetricsSystem.registerSinks(MetricsSystem.scala:181)
          at org.apache.spark.metrics.MetricsSystem.start(MetricsSystem.scala:98)
          at org.apache.spark.SparkContext.&lt;init&gt;(SparkContext.scala:390)
          at org.apache.spark.api.java.JavaSparkContext.&lt;init&gt;(JavaSparkContext.scala:61)
          at spark.mllibClassifier.JavaRandomForests.run(JavaRandomForests.java:105)
          at spark.mllibClassifier.SparkMLlibMain.runMain(SparkMLlibMain.java:263)
          at spark.mllibClassifier.JavaRandomForests.main(JavaRandomForests.java:221)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.module.SimpleSerializers.&lt;init&gt;(Ljava/util/List;)V
          at com.codahale.metrics.json.MetricsModule.setupModule(MetricsModule.java:223)
          at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:469)
          at org.apache.spark.metrics.sink.MetricsServlet.&lt;init&gt;(MetricsServlet.scala:45)
  </code></pre>
  
  <p>My pom file is as follows. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;projects&lt;/groupId&gt;
      &lt;artifactId&gt;project1&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.lucene&lt;/groupId&gt;
              &lt;artifactId&gt;lucene-core&lt;/artifactId&gt;
              &lt;version&gt;5.0.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.lucene&lt;/groupId&gt;
              &lt;artifactId&gt;lucene-analyzers-common&lt;/artifactId&gt;
              &lt;version&gt;5.0.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;commons-io&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
  
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
                  &lt;artifactId&gt;spark-core_2.10&lt;/artifactId&gt;
                  &lt;version&gt;1.3.0&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
                  &lt;artifactId&gt;spark-mllib_2.10&lt;/artifactId&gt;
                  &lt;version&gt;1.3.0&lt;/version&gt;
              &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;colt&lt;/groupId&gt;
              &lt;artifactId&gt;colt&lt;/artifactId&gt;
              &lt;version&gt;1.2.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;descriptorRefs&gt;
                      &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                  &lt;/descriptorRefs&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>