Quarkus 多模块项目中的 ClassCastException [英] ClassCastException in Quarkus multi-module project

查看:64
本文介绍了Quarkus 多模块项目中的 ClassCastException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题似乎类似于多模块项目中的ClassCastException在 Quarkus (gradle) 上运行.

My problem seems similar to ClassCastException in multi-module project running on Quarkus (gradle).

不过,我正在使用 maven.我可以确认在使用跑步者或测试时不会出现问题.我创建了一个示例应用程序来重现 https://github.com/AmsterdamFilho/quarkus-poc.

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.

如果您在开发模式下运行应用程序并使用 swagger-ui 或 curl 执行端点,则会出现异常:

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 不能转换为类 br.com.quarkus.poc.AnimalKindService (br.com.quarkus.poc.AnimalKindService_ClientProxy is在加载器app"的未命名模块中;br.com.quarkus.poc.AnimalKindService 在加载器 io.quarkus.runner.RuntimeClassLoader @7c6908d7 的未命名模块中)

Quarkus 版本是 1.1.1.

The Quarkus version is 1.1.1.

任何解决方法将不胜感激.

Any workaround would be much appreciated.

推荐答案

这可能是类加载器的问题.我们在 master 中有一个全新的类加载器设计,它将在 Quarkus 1.3 中出现(大约在一个月后).

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).

如果您使用的是 master,您可以测试您的问题是否已解决?

Could you test your issue is solved if you're using master?

您可以使用 mvn clean install -DskipTests -DskipITs 在本地构建它,然后使用 999-SNAPSHOT 作为版本,或者我们在此处发布快照:https://oss.sonatype.org/content/repositories/snapshots/io/quarkus/ .

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/ .

注意:您将需要使用 quarkus-bom 进行此测试,因此如果您指向 quarkus-universe-bom,请在您的 pom 中更改它.

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.

感谢检查.

这篇关于Quarkus 多模块项目中的 ClassCastException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆