Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't construct a java object for tag:yaml.org,2002:
    primarykey
    data
    text
    <p>When i am trying to create object from data file in getting following exception while assest class is present. i have tried with dum it was able to dump the data but when i have tried to read same data i am getting following exception</p> <pre><code> [ConstructorException: null; Can't construct a java object for tag:yaml.org,2002:model.Asset; exception=Class not found: model.Asset] </code></pre> <p>File reader</p> <pre><code>package utill; import org.yaml.snakeyaml.Yaml; import java.io.File; import java.io.FileInputStream; import java.io.*; import java.io.InputStream; import java.util.*; import model.*; import java.util.LinkedHashMap; import org.yaml.snakeyaml.constructor.Constructor; public class FileReaderUtill { public static List getAssest(String fileName){ LinkedHashMap&lt;String,Asset&gt; assest=null; List&lt;Asset&gt; data= new ArrayList&lt;Asset&gt;(); try{ InputStream input = new FileInputStream(new File("conf/datafile.yaml")); Yaml yaml = new Yaml(); data=(List&lt;Asset&gt;)yaml.load(input); //System.out.println(assest.get("Asset0")); }catch(IOException e){ e.printStackTrace(); } return data; } } </code></pre> <p>Datafile.yaml</p> <pre><code>- !!model.Asset {cid: null, enable: '1', id: re, internalName: df, name: fd} - !!model.Asset {cid: null, enable: '0', id: rexz, internalName: dxxf, name: fdxxx} </code></pre> <p>Assest.java</p> <pre><code>package model; public class Asset { public Asset(){ } public Asset(String id,String cid,String name,String internalName,String enable ){ this.id=id; this.name=name; this.internalName=internalName; this.enable=enable; } public String id; public String cid; public String name; public String internalName; public String enable; } </code></pre> <p>Please help me to solve this issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload