You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Malisetti, Ramanjaneyulu" <Ra...@ca.com> on 2012/11/21 15:24:47 UTC
problem with publishing JAX-RS endpoint using 2.7
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
Re: problem with publishing JAX-RS endpoint using 2.7
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 23/11/12 12:49, Malisetti, Ramanjaneyulu wrote:
> 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.
no problems, thanks for confirming that the issue can be fixed by
getting the packages imported explicitly in Import-Package, I'm
presuming with ',3)' upper range
Cheers, Sergey
>
> Regards
> Raman
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Wednesday, November 21, 2012 9:22 PM
> To: users@cxf.apache.org
> 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
RE: problem with publishing JAX-RS endpoint using 2.7
Posted by "Malisetti, Ramanjaneyulu" <Ra...@ca.com>.
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:sberyozkin@gmail.com]
Sent: Wednesday, November 21, 2012 9:22 PM
To: users@cxf.apache.org
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
Re: problem with publishing JAX-RS endpoint using 2.7
Posted by Sergey Beryozkin <sb...@gmail.com>.
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(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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: problem with publishing JAX-RS endpoint using 2.7
Posted by Sergey Beryozkin <sb...@gmail.com>.
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