Thank you Sergey. I made stupid mistake by not including javax.ws.rs in my 
bundle import section. After correcting this, now end points are started fine.

Regards
Raman

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]] 
Sent: Wednesday, November 21, 2012 9:22 PM
To: [email protected]
Subject: Re: problem with publishing JAX-RS endpoint using 2.7

You can try a snapshot spec bundle at

https://repository.apache.org/content/groups/snapshots/org/apache/servicemix/specs/org.apache.servicemix.specs.jsr339-api-m10/2.2-SNAPSHOT/

(and drop jsr311-api spec bundle)

Sergey

On 21/11/12 14:39, Sergey Beryozkin wrote:
> 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(JAXRSServerFactory
>> Bean.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(Abstract
>> JAXRSFactoryBean.java:315)
>>
>> at
>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactory
>> Bean.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


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to