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

Continuous testing classloading issue #19888

Closed
kenfinnigan opened this issue Sep 2, 2021 · 9 comments · Fixed by #19889
Closed

Continuous testing classloading issue #19888

kenfinnigan opened this issue Sep 2, 2021 · 9 comments · Fixed by #19889
Labels
Milestone

Comments

@kenfinnigan
Copy link
Member

Describe the bug

Resuming tests when running mvn quarkus:dev leads to following error:

: groovy.lang.MissingMethodException: No signature of method: com.fasterxml.jackson.databind.MappingJsonFactory.createJsonGenerator() is applicable for argument types: (ByteArrayOutputStream, com.fasterxml.jackson.core.JsonEncoding) values: [, UTF8]
Possible solutions: createJsonGenerator(java.io.OutputStream), createJsonGenerator(java.io.Writer), createJsonGenerator(java.io.OutputStream, com.fasterxml.jackson.core.JsonEncoding)
The following classes appear as argument class and as parameter class, but are defined by different class loader:
com.fasterxml.jackson.core.JsonEncoding (defined by 'QuarkusClassLoader:Quarkus Base Runtime ClassLoader: TEST@5bf4e32' and 'QuarkusClassLoader:Augmentation Class Loader: DEV@7b4cb9bd')
If one of the method suggestions matches the method you wanted to call, 
then check your class loader setup.
	at io.restassured.internal.RequestSpecificationImpl.body(RequestSpecificationImpl.groovy:753)
	at quarkus.accounts.AccountResourceTest.testCreateAccount(AccountResourceTest.java:69)

Expected behavior

Tests complete without exception

Actual behavior

No response

How to Reproduce?

https://github.com/jclingan/manning-kube-native-microservices/tree/master/chapter2/account-service is the project.

Run mvn quarkus:dev, then press "r" to resume testing.

Output of uname -a or ver

Darwin MacBook-Pro 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.11" 2021-04-20

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.3.Final and 2.2.1.Final

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

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

No response

@kenfinnigan kenfinnigan added the kind/bug Something isn't working label Sep 2, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 2, 2021

/cc @stuartwdouglas

@kenfinnigan
Copy link
Member Author

@stuartwdouglas this sounds similar to some issues you've resolved in the past.

The problem with the test is triggered when trying to convert an object to JSON for a POST: https://github.com/jclingan/manning-kube-native-microservices/blob/master/chapter2/account-service/src/test/java/quarkus/accounts/AccountResourceTest.java#L69

@kenfinnigan
Copy link
Member Author

/cc @jclingan

@stuartwdouglas
Copy link
Member

@kenfinnigan is that a private repo?

@kenfinnigan
Copy link
Member Author

Sorry @stuartwdouglas, forgot about that!

I've forked it and given you access to take a look: https://github.com/kenfinnigan/manning-kube-native-microservices

@stuartwdouglas
Copy link
Member

Quick workaround for now is to add

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>test</scope>
    </dependency>

I am not sure where databind is coming from atm, it is an optional restassured dep so it does not end up in the test class loader, but it is present in the augmentation class loader.

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Sep 3, 2021
The isolated test CL does not need to access anything from the dev CL,
and it just causes leakage problems.

Fixes quarkusio#19888
@kenfinnigan
Copy link
Member Author

Awesome, thanks!

@stuartwdouglas
Copy link
Member

Linked PR should resolve the issue.

@kenfinnigan
Copy link
Member Author

Confirmed the workaround works great! Thanks

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Sep 7, 2021
The isolated test CL does not need to access anything from the dev CL,
and it just causes leakage problems.

Fixes quarkusio#19888
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants