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

Jakarta - EE 10 - RestAssured not supporting JSON-B 3.0 #29225

Open
agoncal opened this issue Nov 12, 2022 · 21 comments
Open

Jakarta - EE 10 - RestAssured not supporting JSON-B 3.0 #29225

agoncal opened this issue Nov 12, 2022 · 21 comments
Assignees
Labels
area/jakarta kind/bug Something isn't working triage/upstream Used for issues which are caused by issues in upstream projects/dependency

Comments

@agoncal
Copy link
Contributor

agoncal commented Nov 12, 2022

Describe the bug

With Quarkus 3.0.0.Alpha1, when we use the ObjectMapperType.JSONB in a RestAssured test, we get a NoClassDefFoundError because it looks for the old javax/json/bind/Jsonb package and not the new one jakarta/json/bind.

    given()
      .body(customer, ObjectMapperType.JSONB)
      .header(CONTENT_TYPE, APPLICATION_JSON)
      .header(ACCEPT, APPLICATION_JSON).
    when()
      .post("/customers").
    then()
      .statusCode(201);

RestAssured 5.2.0 still does not support it. See: rest-assured/rest-assured#1651

Relates to #13459

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.0.Alpha1

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

No response

Additional information

No response

@agoncal agoncal added the kind/bug Something isn't working label Nov 12, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 14, 2022

@gsmet
Copy link
Member

gsmet commented Nov 15, 2022

Yeah. We will have to live with it until REST Assured provides a Jakarta-compatible version.

I will document it but I think we can close it. We will update REST Assured when available.

@gsmet gsmet closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2022
@gsmet gsmet added the triage/upstream Used for issues which are caused by issues in upstream projects/dependency label Nov 15, 2022
@maxandersen
Copy link
Contributor

@gsmet if we close these is there another way to find list of dependencies/blockers we have identified thus far that are still open?

@gsmet gsmet reopened this Nov 15, 2022
@gsmet
Copy link
Member

gsmet commented Nov 15, 2022

Not really. Let's keep it open then. I wouldn't call it a blocker really but yeah better have it in mind.

@geoand
Copy link
Contributor

geoand commented Jan 10, 2023

Is this still an issue?

@gsmet
Copy link
Member

gsmet commented Jan 10, 2023

AFAIK, yes.

@geoand
Copy link
Contributor

geoand commented Jan 10, 2023

kk, thanks

@agoncal
Copy link
Contributor Author

agoncal commented Jan 11, 2023

Yes, still happening in Quarkus 3 Alpha 2 as nothing has changed on the RestAssured side

@gsmet
Copy link
Member

gsmet commented Feb 18, 2023

I started working on that upstream and I will see if I can come up with an acceptable solution.

@konradrenner
Copy link

possible workaround which I tested: using quarkus-resteasy-reactive-jackson instead of quarkus-resteasy-reactive-jsonb (the jackson plugin can handle jsonb annotations).

But it would be nice if the jsonb plugin is working again with restassured, because otherwise it can quickly happen that a mixture of jackson and jsonb annotations is used in an application.

@gian1200
Copy link
Contributor

What is the impact of implementing that workaround? Does it means that quarkus-resteasy-reactive-jackson is importing jsonb annotations? Is that supposed to happen?

@erik-wramner
Copy link

erik-wramner commented Jul 20, 2023

We have a fairly large amount of JSON-B adapters and really need the tests to use JSON-B, which I solved in #13459 (comment). Now, when we are upgrading to 3.2, this hits us hard. I would be fairly uncomfortable running a different JSON library in test than in the released version and we originally switched from Jackson to JSON-B because Jackson lacked features we need.

Any idea how we can fix or work around this? I might help with coding if needed, though I have no experience with the Quarkus code base.

@gian1200
Copy link
Contributor

gian1200 commented Jul 20, 2023

I believe the change should be done in RestAssured (rest-assured/rest-assured#1651)

Not sure if it's only to update the import references, or if there is anything else that should be done. I tried to contribute, but wasn't able to compile the project (I'm not versed on Groovy) and couldn't give much time to solve my environment issue.

@gsmet
Copy link
Member

gsmet commented Jul 20, 2023

It’s more complex than that. I have a branch somewhere with some preliminary work but didn’t have time to finish it yet.

@erik-wramner
Copy link

Right. I think we will pick a few tests and rewrite them without RestAssured to see if we can get them to work and how much effort it takes.

@gian1200
Copy link
Contributor

gian1200 commented Oct 5, 2023

Given that Quarkus 2.x EoL is going to be soon (this year as far as I've read), is there any official/recommended action to take when migrating to Quarkus 3.0?

@hakdogan
Copy link

As far as I understand this is still an issue for version 3.4.3 because in my test case, I am getting the error.

@SaddexProductions
Copy link

Given that Quarkus 2.x EoL is going to be soon (this year as far as I've read), is there any official/recommended action to take when migrating to Quarkus 3.0?

This is a major blocker for my team since all our RestAssured-tests use JSON-B. We have so far resisted to migrate to Quarkus 3 because of this, and I dread when we will have to do anyway. If this can't be fixed, I would also request a migration guide in this case.

@gastaldi
Copy link
Contributor

gastaldi commented Nov 7, 2023

@marufmax
Copy link

+1 having the same issue

@gian1200
Copy link
Contributor

gian1200 commented Feb 2, 2024

Question:

Given that JSONB is still not supported, is this a valid workaround with Jackson?

  1. Update to Quarkus 3 with recommended command
  2. In pom.xml, replace all ...-jsonb with ...-jackson (e.g. quarkus-resteasy-reactive-jsonb to quarkus-resteasy-reactive-jackson)
  3. In the tests, replace ObjectMapperType.JSONB with ObjectMapperType.JACKSON_2
  4. (Optional) Replace jsonb annotations (JsonbTransient, JsonbProperty, JsonbDateFormat) with Jacksons (JsonbTransient, JsonbProperty, JsonFormat)
  5. (Optional) Update any custom JSONB code

Should I consider something else?

What's the difference between JACKSON_1 and JACKSON_2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jakarta kind/bug Something isn't working triage/upstream Used for issues which are caused by issues in upstream projects/dependency
Projects
Status: Todo
Development

No branches or pull requests