问题
My problem seems similar to ClassCastException in multi-module project running on Quarkus (gradle).
I am using maven, though. I can confirm the problem do not occur when using the runner or in tests. I created a sample application to reproduce the issue in https://github.com/AmsterdamFilho/quarkus-poc.
If you run the application in dev mode and execute the endpoint using swagger-ui or curl you get the Exception:
Caused by: java.lang.ClassCastException: class br.com.quarkus.poc.AnimalKindService_ClientProxy cannot be cast to class br.com.quarkus.poc.AnimalKindService (br.com.quarkus.poc.AnimalKindService_ClientProxy is in unnamed module of loader 'app'; br.com.quarkus.poc.AnimalKindService is in unnamed module of loader io.quarkus.runner.RuntimeClassLoader @7c6908d7)
The Quarkus version is 1.1.1.
Any workaround would be much appreciated.
回答1:
This is probably a class loader issue. We have a brand new class loader design in master that will come to Quarkus 1.3 (so roughly in a month).
Could you test your issue is solved if you're using master?
You can either build it locally with mvn clean install -DskipTests -DskipITs
then use 999-SNAPSHOT
as the version or we publish the snapshots here: https://oss.sonatype.org/content/repositories/snapshots/io/quarkus/ .
Note: you will need to use the quarkus-bom
to make this test so change that in your pom if you're pointing to the quarkus-universe-bom
.
Thanks for checking.
来源:https://stackoverflow.com/questions/59900653/classcastexception-in-quarkus-multi-module-project