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

WebClient.post().sendJson(Entity) throws EncodeException for PanacheBaseEntity #6056

Closed
willr3 opened this issue Dec 9, 2019 · 4 comments
Closed
Labels
area/panache kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.

Comments

@willr3
Copy link

willr3 commented Dec 9, 2019

Describe the bug
I have a Hibernate @Entity which extends PanacheEntityBase with String, Integer, Boolean member variables and I want to send it as the json body in a vert.x WebClient. When I call webClient.post(...).sendJson(entity) I see:

io.vertx.core.json.EncodeException: Failed to encode as JSON: interface javax.enterprise.context.RequestScoped (through reference chain: io.hyperfoil.tools.repo.entity.json.Hook["persistent"])
    at io.vertx.core.json.jackson.JacksonCodec.toBuffer(JacksonCodec.java:165)
    at io.vertx.core.spi.json.JsonCodec.toBuffer(JsonCodec.java:72)
    at io.vertx.ext.web.client.impl.HttpContext.handleSendRequest(HttpContext.java:482)
    at io.vertx.ext.web.client.impl.HttpContext.execute(HttpContext.java:286)
    at io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:270)
    at io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:69)
    at io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:32)
    at io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:267)
    at io.vertx.ext.web.client.impl.HttpContext.fire(HttpContext.java:277)
    at io.vertx.ext.web.client.impl.HttpContext.sendRequest(HttpContext.java:179)
    at io.vertx.ext.web.client.impl.HttpContext.handlePrepareRequest(HttpContext.java:356)
    at io.vertx.ext.web.client.impl.HttpContext.execute(HttpContext.java:283)
    at io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:270)
    at io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:69)
    at io.vertx.ext.web.client.impl.predicate.PredicateInterceptor.handle(PredicateInterceptor.java:32)
    at io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:267)
    at io.vertx.ext.web.client.impl.HttpContext.fire(HttpContext.java:277)
    at io.vertx.ext.web.client.impl.HttpContext.prepareRequest(HttpContext.java:166)
    at io.vertx.ext.web.client.impl.HttpRequestImpl.send(HttpRequestImpl.java:331)
    at io.vertx.ext.web.client.impl.HttpRequestImpl.sendJson(HttpRequestImpl.java:316)
    at io.vertx.reactivex.ext.web.client.HttpRequest.sendJson(HttpRequest.java:526)
    at io.hyperfoil.tools.repo.api.HookService.tellHooks(HookService.java:82)
    at io.hyperfoil.tools.repo.api.HookService.newTest(HookService.java:69)
    at io.hyperfoil.tools.repo.api.HookService_ClientProxy.newTest(HookService_ClientProxy.zig:99)
    at io.hyperfoil.tools.repo.api.HookService_VertxInvoker_newTest_f2dc88ef28a38d97b8721d82bde1c1424d137260$$function$$21.handle(HookService_VertxInvoker_newTest_f2dc88ef28a38d97b8721d82bde1c1424d137260$$function$$21.zig:67)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:316)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:834)

Expected behavior
I would expect to be able to use the json encoding that gets used when I return the Entity from a method with @GET annotations

Actual behavior
The method throws an exception and doesn't send the post request

To Reproduce
Steps to reproduce the behavior:

  1. Create an @Entity that extends PanacheBaseEntity
  2. Create a Webclient and try to post the entity sendJson

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:
    Linux laptop 5.0.6-200.fc29.x86_64 Switch to the Maven distributed copy of the SubstrateVM annotations #1 SMP Wed Apr 3 15:09:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version:
    openjdk version "1.8.0_222"
    OpenJDK Runtime Environment (build 1.8.0_222-20190711120915.buildslave.jdk8u-src-tar--b08)
    OpenJDK 64-Bit GraalVM CE 19.2.0 (build 25.222-b08-jvmci-19.2-b02, mixed mode)
  • GraalVM version (if different from Java): 19.2.0.1
  • Quarkus version or git rev: 1.0.1.Final

Additional context
I am able to send the Entity if I use sendBuffer(Buffer.buffer(JsonbBuilder.create().toJson(entity)))
(Add any other context about the problem here.)

@willr3 willr3 added the kind/bug Something isn't working label Dec 9, 2019
@FroMage
Copy link
Member

FroMage commented Dec 9, 2019

This uses a different serialiser to the default jsonb used by RESTEasy, but it should still serialise entities properly.

@nimo23
Copy link
Contributor

nimo23 commented Dec 9, 2019

This uses a different serialiser to the default jsonb used by RESTEasy, but it should still serialise entities properly.

I think it is not working because of the use of jackson within vertx. All the following issues:

are similar: quarkus cannot handle the propagation of the dedicated serialiser (either Json-B or Jackson) to its RS-component (e.g. RestEasy or Jersey). It always uses the host serializer even if other dependencies or extensions want to make use of another serializer as defined in its code. Quarkus ignores that. This leads to wrong (un)marshallings or unexpected error logs.

@geoand
Copy link
Contributor

geoand commented Aug 30, 2023

Is this still an issue?

@FroMage FroMage added the triage/needs-feedback We are waiting for feedback. label Sep 11, 2023
@geoand
Copy link
Contributor

geoand commented Feb 12, 2024

Closing for lack of feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/panache kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

No branches or pull requests

4 participants