Skip to content
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

Unable to serialize jakarta.ws.rs.core.Cookie after updating to 3.2.0 in native-image #35582

Closed
Afrouper opened this issue Aug 27, 2023 · 3 comments · Fixed by #35592
Closed
Assignees
Labels
area/native-image kind/bug Something isn't working
Milestone

Comments

@Afrouper
Copy link

Describe the bug

After updating to Quarkus I am unable to serialize objects containing jakarta.ws.rs.core.Cookie when running in native-image.
I am using the quarkus-resteasy-reactive-jackson dependency. I added a custom serializer to mitigate and the error has gone.

I get the error with macOS and Linux native-images.

Expected behavior

The Class jakarta.ws.rs.core.Cookie is serialized to json.

Actual behavior

I am getting an error during serialization:

2023-08-27 04:47:14,717 ERROR [io.qua.res.rea.jac.run.map.NativeInvalidDefinitionExceptionMapper] (executor-thread-1) Jackson was unable to serialize type 'jakarta.ws.rs.core.Cookie'. Consider annotating the class with '@RegisterForReflection' or using 'org.jboss.resteasy.reactive.RestResponse' as a response type of 'de.afrouper.server.EchoResource#get: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class jakarta.ws.rs.core.Cookie and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS). This appears to be a native image, in which case you may need to configure reflection for the class that is to be serialized (through reference chain: de.afrouper.server.dto.EchoReply["request"]->de.afrouper.server.dto.Request["cookies"]->java.util.Collections$UnmodifiableMap["X-OPENHAB-SESSIONID"])

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)

GraalVM version (if different from Java)

OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)

Quarkus version or git rev

3.2.0

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.4

Additional information

No response

@Afrouper Afrouper added the kind/bug Something isn't working label Aug 27, 2023
@geoand
Copy link
Contributor

geoand commented Aug 28, 2023

Can you please add a sample application we can use to reproduce the issue and test fixes against?

Thanks

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Aug 28, 2023
@Afrouper
Copy link
Author

Hi,

simply take this Project: https://github.com/Afrouper/echo-server-java

When "deleting" class de.afrouper.server. JacksonMapperConfiguration the error occurred in native-image mode.
You do not need to build a docker container.

@geoand
Copy link
Contributor

geoand commented Aug 28, 2023

Thanks.

#35592 takes care of the issue

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Aug 28, 2023
@geoand geoand self-assigned this Aug 28, 2023
geoand added a commit that referenced this issue Aug 28, 2023
Fix Jakarta Cookie serialization in native
@quarkus-bot quarkus-bot bot added this to the 3.4 - main milestone Aug 28, 2023
@gsmet gsmet modified the milestones: 3.4 - main, 3.3.2 Sep 4, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 4, 2023
DavideD added a commit to DavideD/quarkus that referenced this issue Oct 31, 2023
DavideD added a commit to DavideD/quarkus that referenced this issue Oct 31, 2023
DavideD added a commit to DavideD/quarkus that referenced this issue Oct 31, 2023
@aloubyansky aloubyansky modified the milestones: 3.3.2, 3.2.8.Final Oct 31, 2023
aloubyansky pushed a commit to aloubyansky/quarkus that referenced this issue Oct 31, 2023
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 9, 2023
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 10, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/native-image kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants