【问题标题】:org.apache.avro.SchemaParseException: Undefined name:org.apache.avro.SchemaParseException:未定义的名称:
【发布时间】:2017-08-02 05:46:58
【问题描述】:

为了将泛型转换为 avro 架构,我使用以下注释,但之后出现异常

    public class Test2<T>
    {
@AvroSchema("{\"type\":\"array\",\"items\":[\"null\",\"Test4\"]}")
    private Set<T> test4;
}

public class Test4 {

    public Integer getX() {
        return x;
    }

    public void setX(Integer x) {
        this.x = x;
    }

    public Test4(Integer x) {

        this.x = x;
    }

    public Test4() {

    }

    private Integer x;
}

我在这里得到的错误是 org.apache.avro.SchemaParseException:未定义名称:Test4

【问题讨论】:

    标签: serialization avro


    【解决方案1】:

    这件事奏效了

        @AvroSchema("{\"type\":\"array\",\"items\":{\"name\":\"Child\",\"type\":\"record\",\"fields\":[{\"name\":\"x\",\"type\":\"int\"}]}}")
    

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-03
      • 2023-02-07
      相关资源
      最近更新 更多