Hi On 21/11/12 14:24, Malisetti, Ramanjaneyulu wrote:
Hi, We are updating CXF stack from 2.5.2 to 2.7. The following code used to work in 2.3.0 but fails with the following exception. Is there anything wrong with this code?public class ResourcesProvider { public ResourcesProvider() { try { JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean(); factory.setServiceBean(this); String endpointURL = "http://0.0.0.0:8000/sample" factory.setAddress(endpointURL); factory.create(); } catch (Exception ex) { logger.error("Unable to start @ : ", ex); } @GET @Path("/serv1") Public method1() { } @GET @Path("/serv2") Public method2() { } @GET @Path("/serv3") Public method3() { } } Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:201) at com.ca.ucf.remote.ResourcesProvider.start(ResourcesProvider.java:82) ... 31 more Caused by: javax.ws.rs.WebApplicationException at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:315) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:148) ... 32 more
Does it happen in the OSGI container ? (Yes - just saw your follow-up message :-)) Most likely it is to do with the fact that your application has been compiled against JSR-311 (JAX-RS 1.1) library while CXF 2.7.x implements JAX-RS 2.0 (currently depending on JSR-339 m10).
Please see https://issues.apache.org/jira/browse/CXF-4571, the last few comments.
Basically, the next release of m10 and m13 (or whatever is the latest JSR339 API module is available by then) ServiceMix spec bundles will have a fix that will let the existing application bundles compiled against JSR 311 work with CXF 2.7.x without any recompilations against jsr339 api.
The other workaround is to relax the upper range in the application bundle and explicitly import RS related packages with the range [1.1, 3) this will work due to the BC guarantee.
Finally consider recompiling against jsr339-api just to start experimenting with CXF 2.7.x asap,
Thanks, Sergey
