CXF DOSGi 忽略注释

发布于 2024-11-15 18:24:23 字数 2079 浏览 12 评论 0原文

我正在使用 JAX-RS 示例。 此示例包含两个 RESTful Web 服务,一个带有注释,另一个没有注释。

我使用 Maven 构建它并将其与 CXF DOSGi 单包分发一起部署到 Felix 中。没有注释的一个工作得很好,但是另一个有注释的似乎根本被忽略了。我在日志中收到以下消息:

WARNING: No resource methods have been found for resource class org.apache.cxf.dosgi.samples.greeter.rest.GreeterService
Jun 15, 2011 10:34:17 PM org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean checkResources
SEVERE: No resource classes found
Exception in thread "pool-1-thread-1" org.apache.cxf.service.factory.ServiceConstructionException
        at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:122)
        at org.apache.cxf.dosgi.dsw.handlers.JaxRSPojoConfigurationTypeHandler.createServer(JaxRSPojoConfigurationTypeHandler.java:135)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:244)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:78)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:71)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:71)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:40)
        at org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:254)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: javax.ws.rs.WebApplicationException
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:238)
        at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:85)
        ... 11 more

I am using an JAX-RS example.
This example contains two RESTful webservices, one with annotations and another without.

I build it with maven and deploy it into Felix, together with CXF DOSGi single bundle distribution. The one without annotations works fine, however the other with annotations seems to be ignored at all. I get the following message in the log:

WARNING: No resource methods have been found for resource class org.apache.cxf.dosgi.samples.greeter.rest.GreeterService
Jun 15, 2011 10:34:17 PM org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean checkResources
SEVERE: No resource classes found
Exception in thread "pool-1-thread-1" org.apache.cxf.service.factory.ServiceConstructionException
        at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:122)
        at org.apache.cxf.dosgi.dsw.handlers.JaxRSPojoConfigurationTypeHandler.createServer(JaxRSPojoConfigurationTypeHandler.java:135)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:244)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:78)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:71)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:71)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:40)
        at org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:254)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: javax.ws.rs.WebApplicationException
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:238)
        at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:85)
        ... 11 more

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

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

发布评论

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

评论(1

放低过去 2024-11-22 18:24:23

问题是我的包中有 org.apache.servicemix.specs.jsr311-api-1.1 。当我删除它时,JAX-RS 注释已被处理。

UPD.:这是一个线程有关此问题的 CXF 邮件列表

The problem was that I had org.apache.servicemix.specs.jsr311-api-1.1 in my bundles. When I removed it, JAX-RS annotations were processed.

UPD.: Here is a thread on CXF mailing list regarding this issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文