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

avro class-cast-exception in quarkus test #40190

Open
flyinfish opened this issue Apr 22, 2024 · 9 comments
Open

avro class-cast-exception in quarkus test #40190

flyinfish opened this issue Apr 22, 2024 · 9 comments
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) kind/bug Something isn't working

Comments

@flyinfish
Copy link

Describe the bug

so simple that i hope its no duplicate. found similar issues but no solution...
#18776
#16804

when using builder of generated-avro-class it get

2024-04-22 15:49:24,110 ERROR [io.qua.test] (Test runner thread) Test AvroTest#test() failed 
 [Error Occurred After Shutdown]: org.apache.avro.AvroRuntimeException: java.lang.ClassCastException: class org.whatever.SomeChild cannot be cast to class org.whatever.SomeChild (org.whatever.SomeChild is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2686b936; org.whatever.SomeChild is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @6593b104)
        at org.whatever.SomeObject$Builder.build(SomeObject.java:307)
        at org.acme.AvroTest.test(AvroTest.java:10)
Caused by: java.lang.ClassCastException: class org.whatever.SomeChild cannot be cast to class org.whatever.SomeChild (org.whatever.SomeChild is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2686b936; org.whatever.SomeChild is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @6593b104)
        at org.whatever.SomeObject$Builder.build(SomeObject.java:301)
        ... 1 more

Expected behavior

no class-cast-exception

Actual behavior

class-cast-exception

How to Reproduce?

git clone https://github.com/flyinfish/avro-classloading.git
cd avro-classloading
quarkus test

Output of uname -a or ver

Linux C70C7391 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 21.0.1.0.101 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.31+16-SA (build 21.0.1.0.101+3-LTS) OpenJDK 64-Bit Server VM Zulu21.31+16-SA (build 21.0.1.0.101+3-LTS, mixed mode, sharing)

Quarkus version or git rev

3.9.4

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

Warning: JAVA_HOME environment variable is not set. Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /home/u125015/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 21.0.1.0.101, vendor: Azul Systems, Inc., runtime: /usr/lib/jvm/mobi-azuljdk21 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "5.15.146.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

Additional information

No response

@flyinfish flyinfish added the kind/bug Something isn't working label Apr 22, 2024
Copy link

quarkus-bot bot commented Apr 22, 2024

/cc @alesj (kafka), @cescoffier (kafka), @ozangunalp (kafka)

@cescoffier
Copy link
Member

Thanks for reporting. It's a CLI issue. It works perfectly with mvn test.

@cescoffier cescoffier added area/cli Related to quarkus cli (not maven/gradle/etc.) and removed area/kafka labels Apr 24, 2024
@flyinfish
Copy link
Author

@stuartwdouglas @geoand @maxandersen i annotate you as of area/(continous-)testing, area/cli

could you please have a look and check?
works with mvn test fails with mvn quarkus:test mvn quarkus:dev

thanks a lot

@geoand
Copy link
Contributor

geoand commented Jun 12, 2024

I took a quick look and I don't see any easy fix for this

@maxandersen
Copy link
Member

this is not a cli issue, right? its a devmode and continuous test issue, right?

@geoand
Copy link
Contributor

geoand commented Jun 12, 2024

Continuous testing issue

@maxandersen
Copy link
Member

I tried work around using quarkus.test.flat-class-path=true but then hit:

[INFO] [stdout] 2024-06-12 12:16:29,936 ERROR [io.qua.test] (main) Failed to create compiler, runtime compilation will be unavailable: java.lang.NullPointerException: Cannot read field "includeModulePattern" because "this.config" is null
[INFO] [stdout] 	at io.quarkus.deployment.dev.testing.TestSupport.init(TestSupport.java:161)
[INFO] [stdout] 	at io.quarkus.deployment.dev.testing.TestSupport.start(TestSupport.java:136)
[INFO] [stdout] 	at io.quarkus.deployment.dev.testing.TestHandler.accept(TestHandler.java:21)
[INFO] [stdout] 	at io.quarkus.deployment.dev.testing.TestHandler.accept(TestHandler.java:17)
[INFO] [stdout] 	at io.quarkus.runner.bootstrap.AugmentActionImpl.performCustomBuild(AugmentActionImpl.java:162)
[INFO] [stdout] 	at io.quarkus.deployment.dev.IsolatedTestModeMain.accept(IsolatedTestModeMain.java:132)
[INFO] [stdout] 	at io.quarkus.deployment.dev.IsolatedTestModeMain.accept(IsolatedTestModeMain.java:34)
[INFO] [stdout] 	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
[INFO] [stdout] 	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
[INFO] [stdout] 	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
[INFO] [stdout] 	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)

@flyinfish
Copy link
Author

Continuous testing issue

so it gets the right label and will be fixed hopefully some day in future? we're providing a quarkus platform and try to "promote" continuous testing.

using @QuarkusTest instead of simple unittest just to workaround the issue is somehow odd.
thanks a lot

@geoand
Copy link
Contributor

geoand commented Jun 12, 2024

For now you would have to exclude those tests for the continuous testing run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants