Helidon 2.6.6集成OpenAPI UI遭遇NoClassDefFoundError问题求助
Helidon 2.6.6 OpenAPI UI 依赖冲突解决
你遇到的java.lang.NoClassDefFoundError: io/smallrye/openapi/ui/Option错误,根源是手动指定的smallrye-open-api-ui:2.0.0版本和Helidon 2.6.6内置的SmallRye OpenAPI版本不兼容,且helidon-integrations-openapi-ui已经集成了所需的UI组件,无需额外引入SmallRye的UI依赖。
修正后的pom.xml依赖配置
移除冲突的smallrye-open-api-ui依赖,保留以下两个即可:
<dependency> <groupId>io.helidon.microprofile.openapi</groupId> <artifactId>helidon-microprofile-openapi</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>io.helidon.integrations.openapi-ui</groupId> <artifactId>helidon-integrations-openapi-ui</artifactId> <scope>runtime</scope> </dependency>
补充说明
- Helidon的BOM会自动管理所有依赖的兼容版本,无需手动指定第三方组件版本,从根源避免版本冲突问题。
- 项目启动后,可通过
/openapi路径访问OpenAPI文档,通过/openapi/ui路径访问Swagger UI界面。
内容的提问来源于stack exchange,提问作者Levi Ackerman
相关产品推荐
相关产品推荐

