title: No applicable constructor/method found for zero actual parameters - Apache Spark Java
body: <p>I have been facing strange error with my spark job at runtime. I don't see anything wrong with <code>MyBean</code> class, any idea what could be wrong with below driver code? Thanks</p>
  
  <p><strong>Maven Dependencies-</strong></p>
  
  <pre><code>&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;2.1.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
      &lt;artifactId&gt;spark-sql_2.10&lt;/artifactId&gt;
      &lt;version&gt;2.1.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Driver-</strong></p>
  
  <pre><code>SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
  spark.createDataset(Arrays.asList(new MyBean(10),new MyBean(20)),
        Encoders.bean(MyBean.class)).show();
  </code></pre>
  
  <p>.....</p>
  
  <pre><code>class MyBean implements Serializable {
      int i;
      public MyBean(){}
      public MyBean(int i){this.i=i;}
      public int getI() {return i;}
      public void setI(int i) {this.i = i;}
  }
  </code></pre>
  
  <p>Runtime Exception-</p>
  
  <blockquote>
    <p>ERROR
     org.codehaus.commons.compiler.CompileException:org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator
    org.codehaus.commons.compiler.CompileException: File 'generated.java',
    Line 43,  Column 21: No applicable constructor/method found for zero
    actual parameters;  candidates are: "public int
    com.ts.spark.datasets.MyBean.getI()"  at
    org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:11004)
      at
    org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:8307)
      at
    org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:8169)
      at
    org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:8071)</p>
  </blockquote>