exception is : com/fasterxml/jackson/datatype/jsr310/ser/ZoneIdSerial

时间:2025-04-01 09:14:00

背景:

 SpringBoot工程引入序列化工具:

     <dependency>
          <groupId></groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.8.1</version>
      </dependency>
      <dependency>
          <groupId></groupId>
          <artifactId>jackson-annotations</artifactId>
          <version>2.8.1</version>
      </dependency>

  工程运行时报错:

Caused by: : Failed to instantiate [.]: Constructor threw exception; nested exception is : com/fasterxml/jackson/datatype/jsr310/ser/ZoneIdSerializer

 原因分析:

 springboot自身的框架中引入了jackson框架,包冲突,可以升级成以下版本,即可解决问题:

<!--Jackson required包-->
<dependency>
   <groupId></groupId>
   <artifactId>jackson-core</artifactId>
   <version>2.11.2</version>
</dependency>
<dependency>
   <groupId></groupId>
   <artifactId>jackson-databind</artifactId>
   <version>2.11.2</version>
</dependency>
<dependency>
   <groupId></groupId>
   <artifactId>jackson-annotations</artifactId>
   <version>2.11.2</version>
</dependency>