Json nifi avro-找不到架构中定义的包命名空间

Json nifi avro-找不到架构中定义的包命名空间,json,avro,apache-nifi,Json,Avro,Apache Nifi,我是NiFi和Avro的新手,我的任务是弄清楚它是否对我的团队的需要有用。我试图使用NiFi将Json转换为Avro,但在转换过程中,我在公告栏上不断看到以下错误(注意,我使用的是带有JSONTERREADER和AvroRecordSetWriter的“ConvertRecord”处理器): 将路由到失败:java.lang.NullPointerException:com.product.subproduct.function.productID字段中com.product.subproduc

我是NiFi和Avro的新手,我的任务是弄清楚它是否对我的团队的需要有用。我试图使用NiFi将Json转换为Avro,但在转换过程中,我在公告栏上不断看到以下错误(注意,我使用的是带有JSONTERREADER和AvroRecordSetWriter的“ConvertRecord”处理器):

将路由到失败:java.lang.NullPointerException:com.product.subproduct.function.productID字段中com.product.subproduct.function.Message的null

下面是架构的快照:

{
  "type" : "record",
  "name" : "Message",
  "namespace" : "com.product.subproduct.function",
  "fields" : [ {
    "name" : "messageId",
    "type" : {
      "type" : "record",
      "name" : "productID",
      "fields" : [ {
        "name" : "subproductId",
        "type" : {
          "type" : "record",
          "name" : "subproductId",
          "fields" : [ {
            "name" : "value",
            "type" : "string"
          }, {
            "name" : "type",
            "type" : "string"
          } ]
        }
      }, {
        "name" : "accountId",
        "type" : "string"
      }, {
        "name" : "entityId",
        "type" : "string"
      }, {
        "name" : "clientId",
        "type" : "string"
      } ]
    }
  }
我是否需要在模式中提供名称空间的完整路径,或者我是否错过了一个关键步骤


非常感谢

错误消息是productId字段为空,如果您可以提供您正在尝试处理的json示例,这将非常有用。除了Bryan建议的内容,您是否可以尝试从示例输入构建Avro模式,使用
InferAvroSchema
处理器并在
RecordReader/Writer
控制器服务中使用该模式?@SivaprasannaSethuraman您的建议奏效了,谢谢。