Hi Team,

I stripped out my avro schema file and json file to only one element and
yet it continues to give me the same error.

Exception in thread "main" *org.apache.avro.AvroTypeException: Expected
field name not found*: TMS_ID

*--- avsc file ---*
{
  "type" : "record",
  "name" : "DataModel",
  "fields" : [
{ "name" : "TMS_ID", "type" : "string", "default" : "NONE" }
]
}

*--- json file ---*
{
    "DataModel" :{
"TMS_ID" : "asdf"
}
}

*--- avro validation query ---*
java -jar avro-tools-1.8.1.jar fromjson --schema-file TMSDataModelFlat.avsc
90573445988483.json > validated.avro

*--- error ---*
Exception in thread "main" org.apache.avro.AvroTypeException: Expected
field name not found: TMS_ID
        at org.apache.avro.io.JsonDecoder.doAction(JsonDecoder.java:477)
        at org.apache.avro.io.parsing.Parser.advance(Parser.java:88)
        at org.apache.avro.io.JsonDecoder.advance(JsonDecoder.java:139)
        at org.apache.avro.io.JsonDecoder.readString(JsonDecoder.java:219)
        at org.apache.avro.io.JsonDecoder.readString(JsonDecoder.java:214)
        at org.apache.avro.io.ResolvingDecoder.readString(
ResolvingDecoder.java:201)
        at org.apache.avro.generic.GenericDatumReader.readString(
GenericDatumReader.java:430)
        at org.apache.avro.generic.GenericDatumReader.readString(
GenericDatumReader.java:422)
        at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(
GenericDatumReader.java:180)
        at org.apache.avro.generic.GenericDatumReader.read(
GenericDatumReader.java:152)
        at org.apache.avro.generic.GenericDatumReader.readField(
GenericDatumReader.java:240)
        at org.apache.avro.generic.GenericDatumReader.readRecord(
GenericDatumReader.java:230)
        at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(
GenericDatumReader.java:174)
        at org.apache.avro.generic.GenericDatumReader.read(
GenericDatumReader.java:152)
        at org.apache.avro.generic.GenericDatumReader.read(
GenericDatumReader.java:144)
        at org.apache.avro.tool.DataFileWriteTool.run(
DataFileWriteTool.java:99)
        at org.apache.avro.tool.Main.run(Main.java:87)
        at org.apache.avro.tool.Main.main(Main.java:76)

Reply via email to