Support Questions

Find answers, ask questions, and share your expertise

NiFi InferAvroSchema error - illegal character

avatar
Expert Contributor

Hi All,

I'm trying to convert data in JSON to Avro using ConvertJSONToAvro; and for the Avro schema ConvertJSONToAvro processor requires, I'm using InferAvroSchema processor; but I'm getting an error at InferAvroSchema; it throws "org.apache.avro.schemaparseexception illegal character in: avro-schema" error. I looked at the flowfile contents and replaced all attributes names that have a .(dot) with _(underscore), but still no help. Rest of the flowfile data looks ok, so I'm not sure what's causing the exception.

Any thoughts on how to resolve this would be greatly appreciated.

Thanks.

1 ACCEPTED SOLUTION

avatar
Master Guru

Does the term "avro-schema" (from your error message) appear in the schema? If so, then the error is because it doesn't like the dash, you can only use upper- and lower-case letters and underscores for the first character, then that set plus digits for all remaining characters (see Naming section of Avro doc). Try replacing the dash with an underscore and it should work.

View solution in original post

4 REPLIES 4

avatar
Master Guru

Does the term "avro-schema" (from your error message) appear in the schema? If so, then the error is because it doesn't like the dash, you can only use upper- and lower-case letters and underscores for the first character, then that set plus digits for all remaining characters (see Naming section of Avro doc). Try replacing the dash with an underscore and it should work.

avatar
Expert Contributor

Thanks, that worked.

in InferAvroSchema's Avro Record Name property, I had avro-schema, which I changed to AvroSchema and that did it.

avatar
Master Guru

I have written up an improvement Jira to add better validation for the Avro Record Name property.

avatar

@Raj B Is there any chance you can share an example of the JSON message and any stack trace that is output in nifi-app.log?