javaserializationhashmapgraalvm

objectInputStream.readObject() java.io.InvalidClassException: java.util.HashMap; local class incompatible: stream classdesc with graalVM


Use return (Map<?, ?>) objectInputStream.readObject(); to get a Map without failing in graalVM native image.

The code is actually very simple. Just two files which can be copy pasted to your environment to reproduce.

private static Map<?, ?> getNormalizedMap(String encoded) {
        try (var objectInputStream = new ObjectInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(encoded)))) {
            return (Map<?, ?>) objectInputStream.readObject(); // issue here !
        } catch (IOException | ClassNotFoundException | IllegalArgumentException e) {
            LOGGER.error("encoded={}", encoded, e);
            return Map.of();
        }
    }

full file:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.Base64;
import java.util.Map;

@RestController
@SpringBootApplication
public class GraalissueApplication {

    public static void main(String[] args) {
        SpringApplication.run(GraalissueApplication.class, args);
    }

    @GetMapping("/graalissue")
    public String index() {
        String base64encoded = "rO0ABXNyACVqYXZhLnV0aWwuQ29sbGVjdGlvbnMkVW5tb2RpZmlhYmxlTWFw8aWo/nT1B0ICAAFMAAFtdAAPTGphdmEvdXRpbC9NYXA7eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAADAdwgAAAEAAAAAKXQAFXN0YWdlLWV2ZW50cy1vc2NfdWktKnNyABFqYXZhLnV0aWwuSGFzaFNldLpEhZWWuLc0AwAAeHB3DAAAABA/QAAAAAAABnQACHVzZXIudWlkdAAHdXNlci5pZHQAD3VzZXIuZXh0ZXJuYWxJZHQACWRldmljZS5pZHQACGRldmljZUlkdAAGdXNlcklkeHQAIXN0YWdlLWV2ZW50cy13YnRfaW5mcmFzdHJ1Y3R1cmUtKnNxAH4ABncMAAAAED9AAAAAAAAG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edMap(base64encoded);
        return "It should be 41 here => " + map.size();
    }

    private static Map<?, ?> getNormalizedMap(final String encoded) {
        try (var objectInputStream = new ObjectInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(encoded)))) {
            return (Map<?, ?>) objectInputStream.readObject();
        } catch (IOException | ClassNotFoundException | IllegalArgumentException e) {
            e.printStackTrace();
            return Map.of();
        }
    }

}

pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>graalissue</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>graalissue</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>22</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <image>
                        <env>
                            <BP_JVM_VERSION>22</BP_JVM_VERSION>
                            <BP_NATIVE_IMAGE_BUILD_ARGUMENTS>-H:-AddAllFileSystemProviders</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
                        </env>
                    </image>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

return (Map<?, ?>) objectInputStream.readObject(); would return a correct map. In the case of this issue, the expected result should be

  1. just run mvn clean install and run the jar
  2. make a http request, curl http://localhost:8080/graalissue
  3. expected output: "It should be 41 here => 41"

I would expect to see "It should be 41 here => 41" for both native and non native image.

  1. run mvn -Pnative spring-boot:build-image this would create the graalvm native image
  2. run docker tag docker.io/library/graalissue:0.0.1-SNAPSHOT graalissue:latest
  3. docker run -p 8080:8080 graalissue:latest
  4. curl http://localhost:8080/graalissue The output size will be 0.

It is failing with either

  1. asking for java.util.Collections$UnmodifiableMap to be added to serialization-config.json
  2. if I add java.util.Collections$UnmodifiableMap to serialization-config.json (which I am not even sure is correct) I will get java.io.InvalidClassException: java.util.HashMap; local class incompatible: stream classdesc

If I am not adding anything to serialization-config.json, it will error, and the stack trace will ask me to add java.util.Collections$UnmodifiableMap to serialization-config.json

If I add it, I would get this stack trace:

java.io.InvalidClassException: java.util.HashMap; local class incompatible: stream classdesc serialVersionUID = 362498820763181265, local class serialVersionUID = -3563561681480877083
        at java.base@22.0.1/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:598)
        at java.base@22.0.1/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2063)
        at java.base@22.0.1/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1912)
        at java.base@22.0.1/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2237)
        at java.base@22.0.1/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1747)
        at java.base@22.0.1/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2603)
        at java.base@22.0.1/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2454)
        at java.base@22.0.1/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2269)
        at java.base@22.0.1/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1747)
        at java.base@22.0.1/java.io.ObjectInputStream.readObject(ObjectInputStream.java:525)
        at java.base@22.0.1/java.io.ObjectInputStream.readObject(ObjectInputStream.java:483)

How to work around this issue?

How to properly return (Map<?, ?>) objectInputStream.readObject(); in graalVM native image, as the code in non native image has no issue at all?


Solution

  • Assuming that only the serialVersionUID mismatches but the structure is otherwise the same, you can use a custom object input stream substituting the class descriptor:

    class FixingObjectInputStream extends ObjectInputStream {
        public FixingObjectInputStream(InputStream in) throws IOException {
            super(in);
        }
    
        @Override
        protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
            ObjectStreamClass streamDescriptor = super.readClassDescriptor();
            return streamDescriptor.getName().equals("java.util.HashMap")?
                ObjectStreamClass.lookup(HashMap.class): // use runtime version
                streamDescriptor;
        }
    }
    

    Since the returned class descriptor for HashMap describes the actual runtime version rather than the one serialized in the stream, this will pass all compatibility checks. But it will break later if the actual data are incompatible.

    If the runtime version even differs in the internal format, it’s still possible to read the stream version. We just need a substitute for the class found in the stream, whose instances we replace after their deserialization:

    // matches the serialized format of OpenJDK’s and compatible HashMaps
    static class StreamMap<K, V> implements Serializable {
        transient Object[] data;
        int threshold;
        float loadFactor;
    
        private void writeObject(java.io.ObjectOutputStream out) throws IOException {}
    
        private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
            in.readFields();
            in.readInt();
            int size = in.readInt();
            data = new Object[size * 2];
            for(int counter = 0, index = 0; counter < size; counter++) {
              data[index++] = in.readObject();
              data[index++] = in.readObject();
            }
        }
    
        Object readResolve() throws ObjectStreamException {
            HashMap<Object,Object> actualResult = new HashMap<>();
            for(int index = 0; index < data.length; ) {
                actualResult.put(data[index++], data[index++]);
            }
            System.out.println("StreamMap.readResolve(): constructed actual map");
            return actualResult;
        }
    }
    

    Then, adapt the FixingObjectInputStream:

    class FixingObjectInputStream extends ObjectInputStream {
        public FixingObjectInputStream(InputStream in) throws IOException {
            super(in);
        }
    
        @Override
        protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
            ObjectStreamClass streamDescriptor = super.readClassDescriptor();
            return streamDescriptor.getName().equals("java.util.HashMap")?
                ObjectStreamClass.lookup(StreamMap.class): // use replacement
                streamDescriptor;
        }
    }
    

    …and we can read the map even when the runtime version of HashMap has been implemented totally different:

    String encoded = "rO0ABXNyACVqYXZhLnV0aWwuQ29sbGVjdGlvbnMkVW5tb2RpZmlhYmxlTWFw8aWo/nT1B0ICAAFMAAFtdAAPTGphdmEvdXRpbC9NYXA7eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAADAdwgAAAEAAAAAKXQAFXN0YWdlLWV2ZW50cy1vc2NfdWktKnNyABFqYXZhLnV0aWwuSGFzaFNldLpEhZWWuLc0AwAAeHB3DAAAABA/QAAAAAAABnQACHVzZXIudWlkdAAHdXNlci5pZHQAD3VzZXIuZXh0ZXJuYWxJZHQACWRldmljZS5pZHQACGRldmljZUlkdAAGdXNlcklkeHQAIXN0YWdlLWV2ZW50cy13YnRfaW5mcmFzdHJ1Y3R1cmUtKnNxAH4ABncMAAAAED9AAAAAAAAGcQB+AAhxAH4ACXEAfgAKcQB+AAtxAH4ADHEAfgANeHQAFHN0YWdlLWV2ZW50cy1hYmh1Yi0qc3EAfgAGdwwAAAAQP0AAAAAAAAZxAH4ACHEAfgAJcQB+AApxAH4AC3EAfgAMcQB+AA14dAAYc3RhZ2UtZXZlbnRzLXJkc3BvcnRhbC0qc3EAfgAGdwwAAAAQP0AAAAAAAAZxAH4ACHEAfgAJcQB+AApxAH4AC3EAfgAMcQB+AA14dAAVZXZlbnRzLWdmZV9hZmZpbml0eS0qc3EAfgAGdwwAAAAQP0AAAAAAAAZxAH4ACHEAfgAJcQB+AApxAH4AC3EAfgAMcQB+AA14dAAec3RhZ2UtZXZlbnRzLWF1dG9tYXRlZF90ZXN0cy0qc3EAfgAGdwwAAAAQP0AAAAAAAAZxAH4ACHEAfgAJcQB+AApxAH4AC3EAfgAMcQB+AA14dAAYc3RhZ2UtZXZlbnRzLWdmZWNsaWVudC0qc3EAfgAGdwwAAAAQP0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hc2hwcm9jZXNzb3ItKnNxAH4ABncMAAAAED9AAAAAAAAGcQB+AAhxAH4ACXEAfgAKcQB+AAtxAH4ADHEAfgANeHQAFnN0YWdlLWV2ZW50cy1wYXJsbGF5LSpzcQB+AAZ3DAAAABA/QAAAAAAABnEAfgAIcQB+AAlxAH4ACnEAfgALcQB+AAxxAH4ADXh0ACJzdGFnZS1yZWNvbXByZXNzb3ItZ2ZlX2ZlZWRiYWNrcy0qc3EAfgAGdwwAAAAQP0AAAAAAAAZxAH4ACHEAfgAJcQB+AApxAH4AC3EAfgAMcQB+AA14dAAXc3RhZ2UtZXZlbnRzLW52Y2FudmFzLSpzcQB+AAZ3DAAAABA/QAAAAAAABnEAfgAIcQB+AAlxAH4ACnEAfgALcQB+AAxxAH4ADXh0AB1zdGFnZS1mZWVkYmFja3MtZGlhZ25vc3RpY3MtKnNxAH4ABncMAAAAED9AAAAAAAAGcQB+AAhxAH4ACXEAfgAKcQB+AAtxAH4ADHEAfgANeHg=";
    
    try(var objectInputStream = new FixingObjectInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(encoded)))) {
        var map = (Map<?, ?>) objectInputStream.readObject();
        System.out.println(map.size() == 41);
        map.forEach((k,v) -> System.out.println(k + "-> " + v));
    }
    
    StreamMap.readResolve(): constructed actual map
    true
    stage-feedbacks-gfeclient-*-> [user.uid, user.id, device.id, deviceId, userId, user.externalId]
    stage-feedbacks-gfe_nvbackend-*-> [user.uid, user.id, device.id, deviceId, userId, user.externalId]
    …