You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andras Nagy <an...@gmail.com> on 2013/06/06 09:23:17 UTC

endless recursion in creating client proxy

Hi All,

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 "Product"s which contain "parts" which are also "Product"s
("Parts" 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 (Product -> Parts -> Product).
When this loop is "immediate", i.e. Product directly references its part
Products without the separate "Parts" 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.

If this is not a known limitation, I would go ahead and file it in the
issue tracker with the actual code sample, I'd just like someone to confirm
that.

Of course it's also possible that I'm just doing something wrong. Here are
the relevant resource interfaces (simplified):

@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);

Thank you for your help,
best regards,
Andras

Re: endless recursion in creating client proxy

Posted by Andras Nagy <an...@gmail.com>.
Hi Sergey,
I have created an issue in Jira and attached the sample code that can be
used to reproduce the problem:
https://issues.apache.org/jira/browse/CXF-5073
Thanks,
Andras



On Thu, Jun 6, 2013 at 1:26 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On 06/06/13 08:23, Andras Nagy wrote:
>
>> Hi All,
>>
>> 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 "Product"s which contain "parts" which are also "Product"s
>> ("Parts" 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 (Product -> Parts -> Product).
>> When this loop is "immediate", i.e. Product directly references its part
>> Products without the separate "Parts" 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.
>>
>> If this is not a known limitation, I would go ahead and file it in the
>> issue tracker with the actual code sample, I'd just like someone to
>> confirm
>> that.
>>
>>  Likely a bug somewhere in the client proxy creation, though not exactly
> sure where
>
>
>
>  Of course it's also possible that I'm just doing something wrong. Here are
>> the relevant resource interfaces (simplified):
>>
>> @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);
>>
>>
> Can you please open a JIRA with the details, I wonder where does it go
> into the loop...
>
> Thanks, Sergey
>
>
>  Thank you for your help,
>> best regards,
>> Andras
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: endless recursion in creating client proxy

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 06/06/13 08:23, Andras Nagy wrote:
> Hi All,
>
> 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 "Product"s which contain "parts" which are also "Product"s
> ("Parts" 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 (Product -> Parts -> Product).
> When this loop is "immediate", i.e. Product directly references its part
> Products without the separate "Parts" 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.
>
> If this is not a known limitation, I would go ahead and file it in the
> issue tracker with the actual code sample, I'd just like someone to confirm
> that.
>
Likely a bug somewhere in the client proxy creation, though not exactly 
sure where


> Of course it's also possible that I'm just doing something wrong. Here are
> the relevant resource interfaces (simplified):
>
> @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);
>

Can you please open a JIRA with the details, I wonder where does it go 
into the loop...

Thanks, Sergey

> Thank you for your help,
> best regards,
> Andras
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com