Pergunta

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
Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top