avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elliot West <tea...@gmail.com>
Subject Re: Avro error "org.apache.avro.AvroTypeException: Expected field name not found"
Date Wed, 09 Aug 2017 18:46:16 GMT
Try:

{
  "TMS_ID" : "asdf"
}

On Wed, 9 Aug 2017 at 19:22, Manish Mehndiratta <web.manish@gmail.com>
wrote:

> 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)
>
>
>

Mime
View raw message