OSGi / Eclipse RCP 环境中的 Resteasy 客户端

发布于 2024-08-18 05:12:36 字数 442 浏览 1 评论 0原文

我正在尝试在 Eclipse 中为 Resteasy 服务构建一个客户端。我认为这很简单 - 但 Resteasy 所做的很多魔力(例如查找 POJO 上的注释、加载 Resteasy 提供程序等)似乎都被 OSGi 类加载器破坏了。我花了相当多的时间来解决依赖关系和伙伴策略的问题,但我遇到了一个绊脚石。我将描述它,但最好的解决方案是为 Resteasy 客户端提供一组预先存在的 OSGi/Eclipse 插件。如果失败的话..

could not find writer for content-tyope application/xml type: com.company.Pojo
org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest:473)

这是轻松的1.2.1.GA。

干杯,罗布。

I'm trying to build a client for a Resteasy service in Eclipse. I thought this would be simple - but a lot of the magic that Resteasy does (e.g. looking up annotations on POJOs, loading the Resteasy providers, etc.) seems to be broken by the OSGi class loader. I've spent quite a bit of time resolving the problems with dependencies and buddy policies, but I've come across a stumbling block. I'll describe it, but the best possible solution would be a pre-existing set of OSGi/Eclipse plugins for the resteasy client. Failing that..

could not find writer for content-tyope application/xml type: com.company.Pojo
org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest:473)

This is resteasy 1.2.1.GA.

Cheers, Rob.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以笙箫默 2024-08-25 05:12:36

好的 - 最终成功解决了这个问题,尽管这不是最优雅的解决方案。

采取的步骤:

  1. 使用 Eclipse 的 JAR 向导创建插件
  2. 导入
    • jaxrs-api-1.2.1.GA.jar
    • resteasy-jaxrs-1.2.1.GA.jar
    • resteasy-jaxb-provider-1.2.1.GA.jar
    • jaxb-api-2.1.jar
    • jaxb-impl-2.1.12.jar
    • slf4j-api-1.5.8.jar
    • slf4j-simple-1.5.8.jar
  3. 导出以下包
    • javax.ws.rs
    • javax.xml.bind.annotation
    • org.jboss.resteasy.client(和所有子包)
    • org.jboss.resteasy.plugins.providers
    • org.jboss.resteasy.plugins.providers.jaxb
    • org.jboss.resteasy.spi
  4. 添加该插件作为依赖项,并以通常的方式获取对客户端的引用

Ok - managed to sort this in the end, although it's not the most elegant solution.

Steps to take:

  1. Use Eclipse's create plug-in from JARs wizard
  2. Import
    • jaxrs-api-1.2.1.GA.jar
    • resteasy-jaxrs-1.2.1.GA.jar
    • resteasy-jaxb-provider-1.2.1.GA.jar
    • jaxb-api-2.1.jar
    • jaxb-impl-2.1.12.jar
    • slf4j-api-1.5.8.jar
    • slf4j-simple-1.5.8.jar
  3. Export the following packages
    • javax.ws.rs
    • javax.xml.bind.annotation
    • org.jboss.resteasy.client (and all subpackages)
    • org.jboss.resteasy.plugins.providers
    • org.jboss.resteasy.plugins.providers.jaxb
    • org.jboss.resteasy.spi
  4. Add that plug-in as a dependency, and obtain a reference to the client in the usual way
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文