[ 
https://issues.apache.org/jira/browse/CXF-5073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13679016#comment-13679016
 ] 

Andras Istvan Nagy edited comment on CXF-5073 at 6/9/13 12:03 PM:
------------------------------------------------------------------

Sample code to reproduce the problem. The class ProductClient (in project 
drProductClient) needs to be run.
                
      was (Author: ainagy):
    Sample code to reproduce the problem. he class ProductClient (in project 
drProductClient) needs to be run.
                  
> endless recursion in creating JAX-RS client proxy
> -------------------------------------------------
>
>                 Key: CXF-5073
>                 URL: https://issues.apache.org/jira/browse/CXF-5073
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.5
>            Reporter: Andras Istvan Nagy
>         Attachments: drProduct.zip
>
>
> I'm having a problem creating a JAX-RS client proxy with CXF version 2.7.5. 
> I wrote a simple sample application designed with a resource model that is 
> built up of "ProductResource"s which contain "parts" which are also 
> "ProductResource"s ("PartsResource" being a collection wrapper resource).
> Creating the client proxy for these resources gets into an endless recursion 
> and eventually fails with a stack overflow. I assume this is related to the 
> loop among the resources (ProductResource -> PartsResource -> 
> ProductResource). 
> When this loop is "immediate", i.e. ProductResource directly references its 
> part ProductResource's without the separate "PartsResource" collection 
> wrapper, the client proxy creation does not get into the endless recursion 
> and succeeds.
> On the server side, there are no problems with either resource model.
> @XmlRootElement(name = "ProductResource")
> @Produces("application/json")
> public interface IProductResource {
> @Path("/parts")
> public IPartsResource getParts();
> ...
> }
> @XmlRootElement(name = "PartsResource")
> @Produces("application/json")
> public interface IPartsResource {
> @Path("/{i}/")
> public IProductResource elementAt(@PathParam("i") String i);
> ...
> }
> And the line that gets into the endless recursion (again simplified a bit):
> IProductResource productResource = 
> JAXRSClientFactory.create("http://localhost:9000";, IProductResource.class);
> The relevant part of the stack trace, showing the endless recursion:
>    ...
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:263)
>       at 
> org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:242)
>     ...
> Best regards,
> Andras

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to