title: SnakeYaml Error Exception in parsing org.yaml.snakeyaml.error.YAMLException: Unable to find property 'First' on class: JavaBeanObject
body: <p>can someone tell me the error in my SnakeYaml usage v1.19. Somehow it cannot serialize the object and I do not know why.</p>
  <p>my JavaBeanObject.java</p>
  <pre><code>import org.yaml.snakeyaml.Yaml;
  import org.yaml.snakeyaml.constructor.Constructor;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;
  import java.nio.file.Files;
  import java.nio.file.Paths;
   
  public class ConfigRunner {
      
      private static File myfile = new File(Paths.get(System.getProperty(&quot;user.home&quot;),&quot;config&quot;, &quot;trial.yml&quot;).toString());
      private static String mypath =myfile.getPath();
      private JavaBeanObject myparam;
  
      public static JavaBeanObject getConfiguration(String filePath) throws IOException{
          Constructor constructor = new Constructor(JavaBeanObject.class);
          Yaml yaml = new Yaml(constructor);
  
          try (InputStream in = Files.newInputStream(Paths.get(filePath))) {
              JavaBeanObject config = yaml.loadAs(in, JavaBeanObject.class);
              System.out.println(config.toString());
              return config;
          }
  
      }
  
      public static void main(String[] args) {
          try {
              System.out.println(mypath);
              getConfiguration(mypath);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  <p>My ConfigRunner:</p>
  <pre><code>import org.yaml.snakeyaml.Yaml;
  import org.yaml.snakeyaml.constructor.Constructor;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;
  import java.nio.file.Files;
  import java.nio.file.Paths;
   
  public class ConfigRunner {
  
      private static File myfile = new File(Paths.get(System.getProperty(&quot;user.home&quot;),&quot;config&quot;, &quot;trial.yml&quot;).toString());
      private static String mypath =myfile.getPath();
      private JavaBeanObject myparam;
  
      public static JavaBeanObject getConfiguration(String filePath) throws IOException{
          Constructor constructor = new Constructor(JavaBeanObject.class);
          Yaml yaml = new Yaml(constructor);
  
          try (InputStream in = Files.newInputStream(Paths.get(filePath))) {
              JavaBeanObject config = yaml.loadAs(in, JavaBeanObject.class);
              System.out.println(config.toString());
              return config;
          }
  
      }
  
      public static void main(String[] args) {
          try {
              System.out.println(mypath);
              getConfiguration(mypath);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  <h2>My trial.yml</h2>
  <pre><code>First: anton
  Second: berta
  Third: caesar
  Fourth: Dora
  </code></pre>
  <hr />
  <p>Ok, the Problem I am facing here is with the Stringbuilder and it cannot serialize the object. The error that I get is:</p>
  <pre><code>C:\Users\domino\config\trial.yml
  
      Exception in thread &quot;main&quot; Cannot create property=First for JavaBean=First: null
      First: null
      Second: null
      Third: null
      Fourth: null
      
       in 'reader', line 1, column 1:
          First: 'anton ... 
                  ^
      at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:313)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:190)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:346)
          at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
          at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141)
          at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127)
          at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
          at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:444)
          at ConfigRunner.getConfiguration(ConfigRunner.java:26)
      
      Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'First' on class: JavaBeanObject
          at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:132)
          at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:121)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.getProperty(Constructor.java:323)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:241)
          at ConfigRunner.main(ConfigRunner.java:36)
  </code></pre>
  <p>Can someone help explain the error?</p>