0

I am working on switching a module inside an existing spring-boot project to use spring native. My nativeBuild is failing with the error below.

Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.fasterxml.jackson.core.JsonFactory._createGenerator(java.io.Writer, com.fasterxml.jackson.core.io.IOContext) Parsing context: parsing com.fasterxml.jackson.core.JsonFactory.createGenerator(JsonFactory.java:1318) parsing com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1164) parsing com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3725) parsing a.b.c.Util.writeManifest(Util.java:61)

Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of com.fasterxml.jackson.core.io.SerializedString are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=com.fasterxml.jackson.core.io.SerializedString. at parsing com.fasterxml.jackson.core.JsonFactory.(JsonFactory.java:186) at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2601)

This is triggered at this piece of code:

  ObjectMapper mapper = new ObjectMapper();
  mapper.writeValue(writer, convertedResults);

I am using:

id 'org.springframework.boot' version '2.5.2' id 'org.springframework.experimental.aot' version '0.10.1' id 'org.graalvm.buildtools.native' version '0.9.0' nativeBuild {
buildArgs("--trace-object-instantiation=com.fasterxml.jackson.core.io.SerializedString --verbose -H:+ReportExceptionStackTraces") }

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing)

I tried reproducing this issue in a standalone spring native project, however, did not run into the same problem. Would you have any pointers on how I can go about investigating this further?

Thanks!

Santosh Kewat
  • 522
  • 6
  • 19

0 Answers0