users@jersey.java.net

Re: [Jersey] com.sun.jersey.impl.uri.UriBuilderImpl.path() throws an unexpected exception

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 27 Oct 2008 09:08:58 +0100

On Oct 24, 2008, at 11:40 PM, Gili wrote:

>
> I tracked this down. The problem turns out that when Guice injects
> Resources
> on behalf of Jersey getClass() returns class Foo$$EnhancerByGuice$
> $7605d971
> whereas Jersey expects class Foo. The "enhanced" class has no @Path
> annotation.
>
> Paul, can you replace the current error message by "Class <name>
> must be
> annotated with the @Path annotation"? I find the current error message
> misleading, because Path is not really null.
>

https://jersey.dev.java.net/issues/show_bug.cgi?id=136

Paul.

> Thanks,
> Gili
>
>
> Gili wrote:
>>
>> uri is a class-field UriInfo.
>>
>> uri.getBaseUriBuilder().path(getClass()) throws the same exception.
>> uri.getPath() returns "administrators"
>>
>> Gili
>>
>>
>> Gili wrote:
>>>
>>> Hi,
>>>
>>> My code invokes:
>>>
>>> uri.getBaseUriBuilder().path(getClass(),
>>> "getAdministrator").build(name)
>>>
>>> and I get the following exception:
>>>
>>> java.lang.IllegalArgumentException: Path is null
>>> at
>>> com
>>> .sun.jersey.impl.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:
>>> 391)
>>> at
>>> com.sun.jersey.impl.uri.UriBuilderImpl.path(UriBuilderImpl.java:237)
>>> at
>>> method
>>> .adcaster
>>> .network
>>> .resources.Administrators.getRelativeURI(Administrators.java:165)
>>> [snip]
>>>
>>> I don't understand why the exception is being thrown. The resource
>>> and
>>> method are not null, the method exists and it has a @Path
>>> annotation.
>>>
>>> Gili
>>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/com.sun.jersey.impl.uri.UriBuilderImpl.path%28%29-throws-an-unexpected-exception-tp1373393p1373584.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>