Avro 生成的类与 json 转换有关的问题 [kotlin]

2023-12-06

我在编组/解组时遇到一个奇怪的问题avro生成的类。我收到的错误是抛出一个不是枚举错误 - 除非我的班级中没有任何枚举。

错误具体是这样的:

com.fasterxml.jackson.databind.JsonMappingException:不是枚举:{“type”:“record”,“name”:“TimeUpdateTopic”,“namespace”:“org.company.mmd.time”,“fields”:[ {"name":"time","type":"double"}]} (通过引用链:org.company.mmd.time.TimeUpdateTopic["schema"]->org.apache.avro.Schema$RecordSchema[ “枚举默认”])

测试用例

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import org.junit.Test

class TimeUpdateTopicTest {
    val objectMapper = ObjectMapper().registerModule(JavaTimeModule())

    @Test
    fun decode() {
        val t = TimeUpdateTopic(1.0)
        objectMapper.writeValueAsString(t)
    }
}

AVDL

@namespace("org.company.mmd.time")
protocol TimeMonitor {

  record TimeUpdateTopic {
    double time;
  }
}

avro任务生成的Java类

/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.company.mmd.time;

import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;

@org.apache.avro.specific.AvroGenerated
public class TimeUpdateTopic extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = -4648318619505855037L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TimeUpdateTopic\",\"namespace\":\"org.company.mmd.time\",\"fields\":[{\"name\":\"time\",\"type\":\"double\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static SpecificData MODEL$ = new SpecificData();

  private static final BinaryMessageEncoder<TimeUpdateTopic> ENCODER =
      new BinaryMessageEncoder<TimeUpdateTopic>(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder<TimeUpdateTopic> DECODER =
      new BinaryMessageDecoder<TimeUpdateTopic>(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageEncoder instance used by this class.
   * @return the message encoder used by this class
   */
  public static BinaryMessageEncoder<TimeUpdateTopic> getEncoder() {
    return ENCODER;
  }

  /**
   * Return the BinaryMessageDecoder instance used by this class.
   * @return the message decoder used by this class
   */
  public static BinaryMessageDecoder<TimeUpdateTopic> getDecoder() {
    return DECODER;
  }

  /**
   * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
   * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
   * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
   */
  public static BinaryMessageDecoder<TimeUpdateTopic> createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder<TimeUpdateTopic>(MODEL$, SCHEMA$, resolver);
  }

  /**
   * Serializes this TimeUpdateTopic to a ByteBuffer.
   * @return a buffer holding the serialized data for this instance
   * @throws java.io.IOException if this instance could not be serialized
   */
  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
    return ENCODER.encode(this);
  }

  /**
   * Deserializes a TimeUpdateTopic from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a TimeUpdateTopic instance decoded from the given buffer
   * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
   */
  public static TimeUpdateTopic fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  @Deprecated public double time;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use <code>newBuilder()</code>.
   */
  public TimeUpdateTopic() {}

  /**
   * All-args constructor.
   * @param time The new value for time
   */
  public TimeUpdateTopic(java.lang.Double time) {
    this.time = time;
  }

  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return time;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: time = (java.lang.Double)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'time' field.
   * @return The value of the 'time' field.
   */
  public double getTime() {
    return time;
  }


  /**
   * Sets the value of the 'time' field.
   * @param value the value to set.
   */
  public void setTime(double value) {
    this.time = value;
  }

  /**
   * Creates a new TimeUpdateTopic RecordBuilder.
   * @return A new TimeUpdateTopic RecordBuilder
   */
  public static org.company.mmd.time.TimeUpdateTopic.Builder newBuilder() {
    return new org.company.mmd.time.TimeUpdateTopic.Builder();
  }

  /**
   * Creates a new TimeUpdateTopic RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new TimeUpdateTopic RecordBuilder
   */
  public static org.company.mmd.time.TimeUpdateTopic.Builder newBuilder(org.company.mmd.time.TimeUpdateTopic.Builder other) {
    if (other == null) {
      return new org.company.mmd.time.TimeUpdateTopic.Builder();
    } else {
      return new org.company.mmd.time.TimeUpdateTopic.Builder(other);
    }
  }

  /**
   * Creates a new TimeUpdateTopic RecordBuilder by copying an existing TimeUpdateTopic instance.
   * @param other The existing instance to copy.
   * @return A new TimeUpdateTopic RecordBuilder
   */
  public static org.company.mmd.time.TimeUpdateTopic.Builder newBuilder(org.company.mmd.time.TimeUpdateTopic other) {
    if (other == null) {
      return new org.company.mmd.time.TimeUpdateTopic.Builder();
    } else {
      return new org.company.mmd.time.TimeUpdateTopic.Builder(other);
    }
  }

  /**
   * RecordBuilder for TimeUpdateTopic instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<TimeUpdateTopic>
    implements org.apache.avro.data.RecordBuilder<TimeUpdateTopic> {

    private double time;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.company.mmd.time.TimeUpdateTopic.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.time)) {
        this.time = data().deepCopy(fields()[0].schema(), other.time);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
    }

    /**
     * Creates a Builder by copying an existing TimeUpdateTopic instance
     * @param other The existing instance to copy.
     */
    private Builder(org.company.mmd.time.TimeUpdateTopic other) {
      super(SCHEMA$);
      if (isValidValue(fields()[0], other.time)) {
        this.time = data().deepCopy(fields()[0].schema(), other.time);
        fieldSetFlags()[0] = true;
      }
    }

    /**
      * Gets the value of the 'time' field.
      * @return The value.
      */
    public double getTime() {
      return time;
    }


    /**
      * Sets the value of the 'time' field.
      * @param value The value of 'time'.
      * @return This builder.
      */
    public org.company.mmd.time.TimeUpdateTopic.Builder setTime(double value) {
      validate(fields()[0], value);
      this.time = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'time' field has been set.
      * @return True if the 'time' field has been set, false otherwise.
      */
    public boolean hasTime() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'time' field.
      * @return This builder.
      */
    public org.company.mmd.time.TimeUpdateTopic.Builder clearTime() {
      fieldSetFlags()[0] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public TimeUpdateTopic build() {
      try {
        TimeUpdateTopic record = new TimeUpdateTopic();
        record.time = fieldSetFlags()[0] ? this.time : (java.lang.Double) defaultValue(fields()[0]);
        return record;
      } catch (org.apache.avro.AvroMissingFieldException e) {
        throw e;
      } catch (java.lang.Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumWriter<TimeUpdateTopic>
    WRITER$ = (org.apache.avro.io.DatumWriter<TimeUpdateTopic>)MODEL$.createDatumWriter(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, SpecificData.getEncoder(out));
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumReader<TimeUpdateTopic>
    READER$ = (org.apache.avro.io.DatumReader<TimeUpdateTopic>)MODEL$.createDatumReader(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, SpecificData.getDecoder(in));
  }

  @Override protected boolean hasCustomCoders() { return true; }

  @Override public void customEncode(org.apache.avro.io.Encoder out)
    throws java.io.IOException
  {
    out.writeDouble(this.time);

  }

  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
    throws java.io.IOException
  {
    org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
    if (fieldOrder == null) {
      this.time = in.readDouble();

    } else {
      for (int i = 0; i < 1; i++) {
        switch (fieldOrder[i].pos()) {
        case 0:
          this.time = in.readDouble();
          break;

        default:
          throw new java.io.IOException("Corrupt ResolvingDecoder.");
        }
      }
    }
  }
}

我在这里做了一些愚蠢和/或错误的事情吗?或者这是一个真正的错误

Updates

我可以使用此函数获取 JSON:

  inline fun <reified T: SpecificRecordBase> StringFromAvroGenerated(obj: T) : String {
        val schema = obj.schema
        val writer = SpecificDatumWriter(T::class.java)
        val stream = ByteArrayOutputStream()
        var jsonEncoder = EncoderFactory.get().jsonEncoder(schema, stream)
        writer.write(obj, jsonEncoder)
        jsonEncoder.flush()
        return stream.toString("UTF-8")
    }

但我认为这对杰克逊来说应该是自动的


所以看来有两种方法可以解决我的问题(感谢将 avro 生成的对象序列化为 json 时出现 JsonMappingException)

编写 Jackson MixIn 来处理获取模式 call

所以第一个选项要求我创建一个 Mixin,如下所示:

abstract class AvroMixIn {
    @JsonIgnore
    abstract fun getSchema(): org.apache.avro.Schema
    @JsonIgnore
    abstract fun getSpecificData() : org.apache.avro.specific.SpecificData
}

然后当我制作对象映射器时:

val objectMapper = ObjectMapper()
     .registerModule(JavaTimeModule())
     .addMixIn(Object::class.java, AvroMixIn::class.java)

I chose Object::class.java而不是实际的类,因为它应该适用于所有类。也许更好的解决方案是将其应用于所有 AvroGenerate 内容所具有的共享基类。

重写 Avro Velocity 模板以自动添加此模板

这实际上是我采取的第一种方法,因为它看起来更“无缝”。

1)查看avro项目 2)复制enum.vm, fixed.vm, protocol.vm, record.vm into a /avro_templates我的项目主根目录下的目录 3)添加@com.fasterxml.jackson.annotation.JsonIgnore模板的属性:

#end
  @com.fasterxml.jackson.annotation.JsonIgnore
  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
  @com.fasterxml.jackson.annotation.JsonIgnore
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.

4)更新gradle任务:

avro {
    dateTimeLogicalType="JSR310"
    templateDirectory = "avro_templates/"
}

5)重新构建avro类

(现在一切正常)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Avro 生成的类与 json 转换有关的问题 [kotlin] 的相关文章

  • 按键时关闭 ModalWindow

    我希望能够在用户按下某个键 在我的例子中是 ESC 时关闭 ModalWindow 我有一个用于按键的 Javascript 侦听器 它调用取消按钮 ID 的单击事件 jQuery modalWindowInfo closeButtonId
  • Spring应用中Eureka健康检查的问题

    我正在开发一个基于 Spring 的应用程序 其中包含多个微服务 我的一个微服务充当尤里卡服务器 到目前为止一切正常 在我所有其他微服务中 用 EnableEurekaClient 我想启用这样的健康检查 应用程序 yml eureka c
  • Mockito:如何通过模拟测试我的服务?

    我是模拟测试新手 我想测试我的服务方法CorrectionService correctPerson Long personId 实现尚未编写 但这就是它将执行的操作 CorrectionService将调用一个方法AddressDAO这将
  • 使用 LinkedList 实现下一个和上一个按钮

    这可能是一个愚蠢的问题 但我很难思考清楚 我编写了一个使用 LinkedList 来移动加载的 MIDI 乐器的方法 我想制作一个下一个和一个上一个按钮 以便每次单击该按钮时都会遍历 LinkedList 如果我硬编码itr next or
  • .properties 中的通配符

    是否存在任何方法 我可以将通配符添加到属性文件中 并且具有所有含义 例如a b c d lalalala 或为所有以结尾的内容设置一个正则表达式a b c anything 普通的 Java 属性文件无法处理这个问题 不 请记住 它实际上是
  • 动态选择端口号?

    在 Java 中 我需要获取端口号以在同一程序的多个实例之间进行通信 现在 我可以简单地选择一些固定的数字并使用它 但我想知道是否有一种方法可以动态选择端口号 这样我就不必打扰我的用户设置端口号 这是我的一个想法 其工作原理如下 有一个固定
  • 如何在 Spring 中禁用使用 @Component 注释创建 bean?

    我的项目中有一些用于重构逻辑的通用接口 它看起来大约是这样的 public interface RefactorAwareEntryPoint default boolean doRefactor if EventLogService wa
  • 如何获取之前的URL?

    我需要调用我的网络应用程序的 URL 例如 如果有一个从 stackoverflow com 到我的网站 foo com 的链接 我需要 Web 应用程序 托管 bean 中的 stackoverflow 链接 感谢所有帮助 谢谢 并不总是
  • java.lang.IllegalStateException:提交响应后无法调用 sendRedirect()

    这两天我一直在尝试找出问题所在 我在这里读到我应该在代码中添加一个返回 我做到了 但我仍然得到 java lang IllegalStateException Cannot call sendRedirect after the respo
  • Hibernate 的 PersistentSet 不使用 hashCode/equals 的自定义实现

    所以我有一本实体书 public class Book private String id private String name private String description private Image coverImage pr
  • 像 Java 这样的静态类型语言中动态方法解析背后的原因是什么

    我对 Java 中引用变量的动态 静态类型和动态方法解析的概念有点困惑 考虑 public class Types Override public boolean equals Object obj System out println i
  • 当 OnFocusChangeListener 应用于包装的 EditText 时,TextInputLayout 没有动画

    不能比标题说得更清楚了 我有一个由文本输入布局包裹的 EditText 我试图在 EditText 失去焦点时触发一个事件 但是 一旦应用了事件侦听器 TextInputLayout 就不再对文本进行动画处理 它只是位于 editText
  • 为什么 Java 8 不允许非公共默认方法?

    让我们举个例子 public interface Testerface default public String example return Hello public class Tester implements Testerface
  • java for windows 中的文件图标叠加

    我正在尝试像 Tortoise SVN 或 Dropbox 一样在文件和文件夹上实现图标叠加 我在网上查了很多资料 但没有找到Java的解决方案 Can anyone help me with this 很抱歉确认您的担忧 但这无法在 Ja
  • 使用 AsyncTask 传递值

    我一直在努力解决这个问题 但我已经到了不知道该怎么办的地步 我想做的是使用一个类下载文件并将其解析为字符串 然后将该字符串发送到另一个类来解析 JSON 内容 所有部件都可以单独工作 并且我已经单独测试了所有部件 我只是不知道如何将值发送到
  • 如何使用 jUnit 将测试用例添加到套件中?

    我有 2 个测试类 都扩展了TestCase 每个类都包含一堆针对我的程序运行的单独测试 如何将这两个类 以及它们拥有的所有测试 作为同一套件的一部分执行 我正在使用 jUnit 4 8 在 jUnit4 中你有这样的东西 RunWith
  • Cucumber 0.4.3 (cuke4duke) 与 java + maven gem 问题

    我最近开始为 Cucumber 安装一个示例项目 并尝试使用 maven java 运行它 我遵循了这个指南 http www goodercode com wp using cucumber tests with maven and ja
  • 在java中为组合框分配键

    我想添加一个JComboBox在 Swing 中这很简单 但我想为组合中的每个项目分配值 我有以下代码 JComboBox jc1 new JComboBox jc1 addItem a jc1 addItem b jc1 addItem
  • 使用 CXF-RS 组件时,为什么我们使用 而不是普通的

    作为后续这个问题 https stackoverflow com questions 20598199 对于如何正确使用CXF RS组件我还是有点困惑 我很困惑为什么我们需要
  • Java中super关键字的范围和使用

    为什么无法使用 super 关键字访问父类变量 使用以下代码 输出为 feline cougar c c class Feline public String type f public Feline System out print fe

随机推荐

  • SwiftUI - 导航视图打开后退按钮和半灰屏/奇怪的行为

    I am trying to add navigation view to my app but it is causing issues My main UI is an infinitely swipe able carousel of
  • CORS 预检选项请求出现 403 错误。怎么修?

    我的项目是创建一个输入页面 用于在其中输入一些文本并将其发送到 mysql phpmyadmin 我正在使用 spring boot 2 1 4 和 Angular 7 预先感谢您的调查 爱 我专注于 GraphController jav
  • 从 Typescript 1.6.2 中的内置数组扩展的类在使用 [] 运算符时不会更新长度

    正如我所读 应该可以在 ts 1 6 中扩展内置类型here TypeScript 1 6 添加了对扩展计算构造函数的任意表达式的类的支持 这意味着现在可以在类声明中扩展内置类型 一些例子 Extend built in types cla
  • SLURM 中两个作业数组之间的一对一依赖关系

    服务器刚刚从 CONDOR 切换到 SLURM 所以我正在学习并尝试将我的提交脚本翻译为 SLURM 我的问题如下 我有两个工作数组 第二个依赖于第一个 目前 我喜欢以下内容 events1 sbatch job name events a
  • 访问 cffi 枚举

    假设我在 cffi 下定义了一个枚举 from cffi import FFI ffi FFI ffi cdef typedef enum RANDOM IMMEDIATE SEARCH strategy 现在调用时可以轻松访问cdef再次
  • 如何在 C# 中从 Json 字符串中检索值

    我收到类似的回复 expires Sat 19 May 2046 04 10 58 0000 copy ref SMJNA2wxbGZbnmbnm Result null error null base expires Sat 19 May
  • 如何将 application/json 对象解析为字符串

    我正在以编程方式导航到返回 application json 格式的站点 我似乎无法读取 HttpURLConnection 中返回的 json 我正在使用 Jackson 将 JSON 解组到 java 对象中 代码是 InputStre
  • 最有用的 R 技巧是什么? [关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心以获得指导 Locked 这个问题及其
  • Java中有常用的有理数库吗?

    我正在寻找一个代表分数 有理数 的Java 库 例如 如果我想存储分数1 3那么它不会被另存为0 33333这将失去其准确性 以下是我期望在此类库中找到的一些功能 getNumerator getDenominator add Ration
  • 多个标头和 ARIA 角色

    我有一个 HTML 结构 它实际上有 2 个标题 在页面的顶部有一些导航项和按钮 下面是另一个部分 其中包含徽标和我所说的主导航 由于全宽 CSS3 渐变 两者都在包装器中被分割 所以我的结构看起来像这样 div div div div
  • 使用 ffmpeg、PHP 和 beanstalk

    我对 ffmpeg 和 beanstalk 很陌生 我需要一些帮助 我想使用 beanstalk 将文件排队以供 ffmpeg 转换 我已经下载 安装并启动了 beanstalkd 还按照建议安装了 libevent 并且我已经下载了 be
  • 用于数字动画的 Jquery 插件

    我正在对服务器进行 ajax 调用 然后更新一些统计信息 我想要一个可以为数字添加动画的插件 例如初始值 65 ajax调用后的值 98 在 2 秒内 显示的值从 65 增加到 98 用户可以看到这一点 就像数字速度表或转速表一样 我的搜索
  • iOS 应用程序在后台时的 GCM 推送通知

    我正在尝试使用 GCM 将推送通知发送到我的 iOS 应用程序 应用程序在后台时不会收到通知 但在前台时会收到通知 我正在使用 PHP 脚本测试推送通知 该脚本还将消息直接发送到 APNS 并且它在后台工作 发送到 GCM 的 JSON 我
  • 将带有图像的 NSAttributedString 保存到 RTF 文件时遇到问题

    我有一些输出 是一个非常简单的 RTF 文件 当我生成此文档时 用户可以通过电子邮件发送它 这一切都运行良好 该文档看起来不错 一旦我有了 NSAttributedString 我就创建一个 NSData 块 并将其写入文件 如下所示 NS
  • 并行输出

    当使用多个进程运行 CMake 生成的 Makefile 时 make jN 输出经常会像这样混乱 8 8 9 Building CXX object App CMakeFiles App dir src File1 cpp o Build
  • JavaFX 8 的基本 JUnit 测试

    我想为 JavaFX 8 应用程序创建基本的 JUnit 测试 我有这个简单的代码示例 public class Main extends Application public static void main String args Ap
  • SQLAlchemy - 在 postgresql 中执行批量更新插入(如果存在,则更新,否则插入)

    我正在尝试使用 SQLAlchemy 模块 而不是 SQL 在 python 中编写批量更新插入 我在 SQLAlchemy 添加中收到以下错误 sqlalchemy exc IntegrityError IntegrityError du
  • 避免打印最后一个逗号

    我正在尝试打印这个循环而不使用最后一个逗号 我一直在谷歌上搜索这个问题 从我所看到的来看 对于这么一个小问题来说 一切似乎都过于复杂 当然有一个简单的解决方案可以避免打印最后一个逗号 如果有人能帮助我 我将不胜感激 这让我发疯 例如 它从
  • 如何获取出现频率最高的值SQL

    我有一个表 Orders id trip id order 表 Trip id hotel id bus id type of trip 和表 Hotel id hotel name 我想获取表订单中最常去的酒店的名称 SELECT hot
  • Avro 生成的类与 json 转换有关的问题 [kotlin]

    我在编组 解组时遇到一个奇怪的问题avro生成的类 我收到的错误是抛出一个不是枚举错误 除非我的班级中没有任何枚举 错误具体是这样的 com fasterxml jackson databind JsonMappingException 不