You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Matt Massie <ma...@massie.us> on 2012/07/30 18:00:33 UTC

Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Let me start by thanking your team for writing such a good piece of code.
CXF has worked well for us.

For one project, we used CXF to create a JAX-RS service that uses nested
subresources. Originally, we only provided a Python client to REST
interface. I'm in the process of using the CXF JAXRSClientFactory to create
a Java client for customers as well.  Unfortunately, the way we've
annotated the code is causing errors in the client code and I'm at a loss
to understand exactly why.

I've distilled the problem down to a simple test case and posted it as a
gist.

      https://gist.github.com/3207745

Whenever I run the above test case, I get the following exception:

java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s)
given for 1 unique variable(s)
 at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:185)
at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:82)
 at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:218)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:152)
 at $Proxy15.getGrandchildResource(Unknown Source)
at com.cloudera.api.v1.impl.TestClass.testCase(TestClass.java:92)

It appears that the client code is unable to generate a request URI from
the @Path annotation we're providing.

Is there anything obviously wrong with the code in the gist that you can
see?  Any guidance you can provide would be very appreciated.

-Matt

Re: Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Posted by Matt Massie <ma...@massie.us>.
Thanks, Sergey!  You're right.  Adding the proper @PathParam to the method
fixed the problem.

-Matt


On Mon, Jul 30, 2012 at 12:53 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Matt
>
>
> On 30/07/12 19:00, Matt Massie wrote:
>
>> Let me start by thanking your team for writing such a good piece of code.
>> CXF has worked well for us.
>>
>> For one project, we used CXF to create a JAX-RS service that uses nested
>> subresources. Originally, we only provided a Python client to REST
>> interface. I'm in the process of using the CXF JAXRSClientFactory to
>> create
>> a Java client for customers as well.  Unfortunately, the way we've
>> annotated the code is causing errors in the client code and I'm at a loss
>> to understand exactly why.
>>
>> I've distilled the problem down to a simple test case and posted it as a
>> gist.
>>
>>        https://gist.github.com/**3207745<https://gist.github.com/3207745>
>>
>
> Thanks for making this code available, helped me reproduce the issue
> immediately.
>
>
>
>> Whenever I run the above test case, I get the following exception:
>>
>> java.lang.**IllegalArgumentException: Unresolved variables; only 0
>> value(s)
>> given for 1 unique variable(s)
>>   at
>> org.apache.cxf.jaxrs.impl.**UriBuilderImpl.**substituteVarargs(**
>> UriBuilderImpl.java:185)
>> at org.apache.cxf.jaxrs.impl.**UriBuilderImpl.doBuild(**
>> UriBuilderImpl.java:82)
>>   at
>> org.apache.cxf.jaxrs.impl.**UriBuilderImpl.**buildFromEncoded(**
>> UriBuilderImpl.java:218)
>> at
>> org.apache.cxf.jaxrs.client.**ClientProxyImpl.invoke(**
>> ClientProxyImpl.java:152)
>>   at $Proxy15.**getGrandchildResource(Unknown Source)
>> at com.cloudera.api.v1.impl.**TestClass.testCase(TestClass.**java:92)
>>
>> It appears that the client code is unable to generate a request URI from
>> the @Path annotation we're providing.
>>
>> Is there anything obviously wrong with the code in the gist that you can
>> see?  Any guidance you can provide would be very appreciated.
>>
>>
> ChildResource has
> @Path("/{childName}/**grandChildren")
>
> on one of its methods,
> but no @PathParam("childName") is avaialble
>
> I've updated the method and the test passed
>
> Cheers, Sergey
>
>  -Matt
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Posted by Matt Massie <ma...@massie.us>.
Thanks, Sergey!  You're right.  Adding the proper @PathParam to the method
fixed the problem.

-Matt


On Mon, Jul 30, 2012 at 12:53 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Matt
>
>
> On 30/07/12 19:00, Matt Massie wrote:
>
>> Let me start by thanking your team for writing such a good piece of code.
>> CXF has worked well for us.
>>
>> For one project, we used CXF to create a JAX-RS service that uses nested
>> subresources. Originally, we only provided a Python client to REST
>> interface. I'm in the process of using the CXF JAXRSClientFactory to
>> create
>> a Java client for customers as well.  Unfortunately, the way we've
>> annotated the code is causing errors in the client code and I'm at a loss
>> to understand exactly why.
>>
>> I've distilled the problem down to a simple test case and posted it as a
>> gist.
>>
>>        https://gist.github.com/**3207745<https://gist.github.com/3207745>
>>
>
> Thanks for making this code available, helped me reproduce the issue
> immediately.
>
>
>
>> Whenever I run the above test case, I get the following exception:
>>
>> java.lang.**IllegalArgumentException: Unresolved variables; only 0
>> value(s)
>> given for 1 unique variable(s)
>>   at
>> org.apache.cxf.jaxrs.impl.**UriBuilderImpl.**substituteVarargs(**
>> UriBuilderImpl.java:185)
>> at org.apache.cxf.jaxrs.impl.**UriBuilderImpl.doBuild(**
>> UriBuilderImpl.java:82)
>>   at
>> org.apache.cxf.jaxrs.impl.**UriBuilderImpl.**buildFromEncoded(**
>> UriBuilderImpl.java:218)
>> at
>> org.apache.cxf.jaxrs.client.**ClientProxyImpl.invoke(**
>> ClientProxyImpl.java:152)
>>   at $Proxy15.**getGrandchildResource(Unknown Source)
>> at com.cloudera.api.v1.impl.**TestClass.testCase(TestClass.**java:92)
>>
>> It appears that the client code is unable to generate a request URI from
>> the @Path annotation we're providing.
>>
>> Is there anything obviously wrong with the code in the gist that you can
>> see?  Any guidance you can provide would be very appreciated.
>>
>>
> ChildResource has
> @Path("/{childName}/**grandChildren")
>
> on one of its methods,
> but no @PathParam("childName") is avaialble
>
> I've updated the method and the test passed
>
> Cheers, Sergey
>
>  -Matt
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

On 30/07/12 19:00, Matt Massie wrote:
> Let me start by thanking your team for writing such a good piece of code.
> CXF has worked well for us.
>
> For one project, we used CXF to create a JAX-RS service that uses nested
> subresources. Originally, we only provided a Python client to REST
> interface. I'm in the process of using the CXF JAXRSClientFactory to create
> a Java client for customers as well.  Unfortunately, the way we've
> annotated the code is causing errors in the client code and I'm at a loss
> to understand exactly why.
>
> I've distilled the problem down to a simple test case and posted it as a
> gist.
>
>        https://gist.github.com/3207745

Thanks for making this code available, helped me reproduce the issue
immediately.

>
> Whenever I run the above test case, I get the following exception:
>
> java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s)
> given for 1 unique variable(s)
>   at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:185)
> at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:82)
>   at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:218)
> at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:152)
>   at $Proxy15.getGrandchildResource(Unknown Source)
> at com.cloudera.api.v1.impl.TestClass.testCase(TestClass.java:92)
>
> It appears that the client code is unable to generate a request URI from
> the @Path annotation we're providing.
>
> Is there anything obviously wrong with the code in the gist that you can
> see?  Any guidance you can provide would be very appreciated.
>

ChildResource has
@Path("/{childName}/grandChildren")

on one of its methods,
but no @PathParam("childName") is avaialble

I've updated the method and the test passed

Cheers, Sergey

> -Matt
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Re: Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

On 30/07/12 19:00, Matt Massie wrote:
> Let me start by thanking your team for writing such a good piece of code.
> CXF has worked well for us.
>
> For one project, we used CXF to create a JAX-RS service that uses nested
> subresources. Originally, we only provided a Python client to REST
> interface. I'm in the process of using the CXF JAXRSClientFactory to create
> a Java client for customers as well.  Unfortunately, the way we've
> annotated the code is causing errors in the client code and I'm at a loss
> to understand exactly why.
>
> I've distilled the problem down to a simple test case and posted it as a
> gist.
>
>        https://gist.github.com/3207745

Thanks for making this code available, helped me reproduce the issue
immediately.

>
> Whenever I run the above test case, I get the following exception:
>
> java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s)
> given for 1 unique variable(s)
>   at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:185)
> at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:82)
>   at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:218)
> at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:152)
>   at $Proxy15.getGrandchildResource(Unknown Source)
> at com.cloudera.api.v1.impl.TestClass.testCase(TestClass.java:92)
>
> It appears that the client code is unable to generate a request URI from
> the @Path annotation we're providing.
>
> Is there anything obviously wrong with the code in the gist that you can
> see?  Any guidance you can provide would be very appreciated.
>

ChildResource has
@Path("/{childName}/grandChildren")

on one of its methods,
but no @PathParam("childName") is avaialble

I've updated the method and the test passed

Cheers, Sergey

> -Matt
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com