【问题标题】:RESTEASY003210: Could not find resource for full path - QuarkusRESTEASY003210:找不到完整路径的资源 - Quarkus
【发布时间】:2020-11-09 07:36:49
【问题描述】:

我正在尝试在 Quarkus 中配置 Swagger。 我的 Quarkus 版本:1.9.2.Final

我的依赖:

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-smallrye-openapi</artifactId>
    </dependency>  

还有我的房产资源:

quarkus.swagger-ui.path=/swagger-ui
quarkus.swagger-ui.always-include=true

当我使用以下命令启动我的应用程序时:mvn compile quarkus:dev 并转到此网址:

http://localhost:8080/swagger-ui_not_found/

显示带有附加端点的红色页面(好的,这就是我想要的)

但是,如果我使用 maven (mvn package) 制作一个包,然后启动 jar,则返回相同的 url:

RESTEASY003210: Could not find resource for full path

这是踪迹:

2020-11-10 07:58:08,244 DEBUG [org.jbo.res.res.i18n] (executor-thread-1) RESTEASY002315: PathInfo: /favicon.ico
2020-11-10 07:58:08,246 DEBUG [org.jbo.res.res.i18n] (executor-thread-1) RESTEASY002305: Failed executing GET /favicon.ico: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/favicon.ico
        at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:70)
        at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:47)
        at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:481)
        at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:332)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:253)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)

我在Quarkus guides 中读到,如果您设置:

quarkus.swagger-ui.always-include=true

你也让它在生产中可用,但在我的情况下它不起作用。

有什么想法吗?

谢谢。

【问题讨论】:

  • 你能分享一下异常堆栈和其他细节吗?而且,如果路径是/swagger-ui,你为什么要打/swagger-ui2
  • 嗨,我已经用堆栈跟踪更新了帖子。另一方面,我试图点击错误的 url,因为我想看到 404 资源页面,而不是一个有错误的空白页面。

标签: quarkus


【解决方案1】:

您是在寻找 swagger-ui 页面,还是带有链接的 404 页面? 据我所知,带有链接的 404 仅在 DEV 模式下可用。

【讨论】:

  • 嗨,我正在寻找带有链接的 404 页面,因为有时,在生产环境中,用户点击了错误的 url,我想显示正确的链接!谢谢
  • 就像我说的,据我所知,这仅在开发模式下可用。您应该能够自己构建它。添加加载您自己的页面的异常@Provider。像这样的东西:stackoverflow.com/questions/57690339/…
  • 好的,谢谢!我认为它也可以在生产模式下工作,所以我将手动进行。谢谢。
【解决方案2】:

通过将quarkus.swagger-ui.always-include=true 添加到application.properties,您还将在 prod-mode jar 中获得 SwaggerUI(可通过 http://localhost:8080/swagger-ui/ 访问)

有关详细信息,请参阅documentation

另请注意,此属性是 构建时间 属性,因此在运行时更改它没有任何效果。

【讨论】:

  • 嗨,我试过了,但它不起作用(见我帖子的最后)
  • 查看我关于该属性是构建时间属性这一事实的更新。
猜你喜欢
  • 2017-02-12
  • 1970-01-01
  • 1970-01-01
  • 2016-02-13
  • 1970-01-01
  • 2022-12-09
  • 2015-04-16
  • 1970-01-01
  • 2016-09-11
相关资源
最近更新 更多