You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andras Istvan Nagy (JIRA)" <ji...@apache.org> on 2013/06/09 13:58:19 UTC

[jira] [Created] (CXF-5073) endless recursion in creating JAX-RS client proxy

Andras Istvan Nagy created CXF-5073:
---------------------------------------

             Summary: 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


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