-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jackson desrialization to Record fails in native builds #25984
Comments
Hi @djrollins this looks like oracle/graal#3984. Can you please check if the issue is still reproducible with Mandrel 22.1 or 21.3.2? |
Still persist as far as I can see on my own project: mvn clean package -Pnative results in |
Still present with Mandrel 22.1: |
Thank you both for responding to this issue. I can confirm that @SpeedsterF2 is right and this issue is still present in Mandrel 22.1.
|
quarkus v2.10.0 with default quay.io/quarkus/ubi-quarkus-mandrel:22.0-java17 fails: quarkus v2.10.0 with quay.io/quarkus/ubi-quarkus-mandrel:22.1-java17 fails with the same stack trace: |
I'm having the same issue with GraalVM |
Since diff --git a/src/main/java/io/acme/jacksonrecords/SomeRecord.java b/src/main/java/io/acme/jacksonrecords/SomeRecord.java
index fefaac3..18a9de3 100644
--- a/src/main/java/io/acme/jacksonrecords/SomeRecord.java
+++ b/src/main/java/io/acme/jacksonrecords/SomeRecord.java
@@ -1,4 +1,7 @@
package io.acme.jacksonrecords;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
record SomeRecord(String name, String surname) {
} (Tested with Mandrel 22.1 and Quarkus 2.10.1.Final) |
That did the trick, I must have overlooked this in the documentation. Thank you! |
Closing this as in this case explicit registration is required |
Describe the bug
We are currently trying to use Java records as POJOs and using Jackson for (de)-serialisation, however, we are hitting the following runtime error:
I have create repository that replicates this issue here: https://github.com/djrollins/quarkus-native-jackson-records.
Expected behavior
Jackson should successfully de-serialize to Java records in native builds.
Actual behavior
Compiled program emits a runtime error when attempting to de-serialize to a Java record.
How to Reproduce?
1, Clone this example repository: https://github.com/djrollins/quarkus-native-jackson-records
2. Create a native build with
mvn package -Pnative
3. Execute the compiled program with
./target/jacksonrecords-0.0.1-SNAPSHOT-runner
4. Observe the com.fasterxml.jackson.databind.exc.InvalidDefinitionException error.
Output of
uname -a
orver
Linux archlinux 5.17.9-arch1-1 #1 SMP PREEMPT Wed, 18 May 2022 17:30:11 +0000 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment (build 17.0.3+7) OpenJDK 64-Bit Server VM (build 17.0.3+7, mixed mode)
GraalVM version (if different from Java)
Using latest docker image for quay.io/quarkus/ubi-quarkus-mandrel:22.0-java17
Quarkus version or git rev
2.9.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /opt/maven Java version: 17.0.3, vendor: N/A, runtime: /usr/lib/jvm/java-17-openjdk Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "5.17.9-arch1-1", arch: "amd64", family: "unix"
Additional information
No response
The text was updated successfully, but these errors were encountered: