Just to confirm that this is not regression of jersey. This is due to
change in JPA wizard that map database field discount code to Character
instead of String. Our existing sample CustomerDB version of
DiscountCode entity class still has this column mapped to String and I
did not see the problem.
I think that we do want to support Character as primary key so I think
we need to change the rule to support Character.
If this is not possible for 0.3, I think we could work around in our
code generation.
-Nam
Paul Sandoz wrote:
> Hi Peter,
>
> The error is referring to an invalid sub-locator method not of a Java
> class. It helps if i format the error output:
>
> Method:
>
> public x.service.CustomersResource
> x.service.DiscountCodeResource.
> getCustomersResource(java.lang.Character)
>
> annotated with URI template /customers(/.*)? of resource:
>
> class x.service.DiscountCodeResource
>
> is not recognized as valid Java method annotated with @URITemplate.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> We can definitely improve on the error output, this is an important
> requirement for the abstract resource model to report very clear,
> accurate and helpful error messages.
>
> Why does the method "getCustomersResource" have a single parameter of
> the type java.lang.Character ?
>
> java.lang.Character does not conform to any of the following rules:
>
> - Not a primitive type (note that 'char' is not a supported primitive
> type);
>
> - Not of type java.lang.String;
>
> - No method of the signature
>
> public static Character valueOf(String)
>
> and;
>
> - No constructor of the signature
>
> public Character(String)
>
>
> The code that supports this logic has not changed since June 19th when
> we went open source. Could you send the Java source just to make sure?
>
> I am a bit reluctant to release 0.3 until we work out what is going
> on, if you are in early and could reply ASAP that would be great.
>
> Thanks,
> Paul.
>
>
> Peter Liu wrote:
>> Hi Paul,
>>
>> I got the following exception when executing the RESTful services
>> generated from entity classes:
>>
>> Caused by: com.sun.ws.rest.api.container.ContainerException: Method,
>> public x.service.CustomersResource
>> x.service.DiscountCodeResource.getCustomersResource(java.lang.Character),
>> annotated with URI template /customers(/.*)? of resource, class
>> x.service.DiscountCodeResource, is not recognized as valid Java
>> method annotated with @URITemplate.
>> at
>> com.sun.ws.rest.impl.model.node.NodeDispatcherFactory.create(NodeDispatcherFactory.java:54)
>>
>> at
>> com.sun.ws.rest.impl.model.ResourceClass.processSubResourceLocators(ResourceClass.java:161)
>>
>> at
>> com.sun.ws.rest.impl.model.ResourceClass.<init>(ResourceClass.java:91)
>> at
>> com.sun.ws.rest.impl.model.RootResourceClass.getResourceClass(RootResourceClass.java:73)
>>
>> at
>> com.sun.ws.rest.impl.application.WebApplicationImpl.getResourceClass(WebApplicationImpl.java:127)
>>
>> at
>> com.sun.ws.rest.impl.application.WebApplicationContext.dispatchTo(WebApplicationContext.java:110)
>>
>> at
>> com.sun.ws.rest.impl.model.node.NodeDispatcher.dispatch(NodeDispatcher.java:58)
>>
>>
>> The DiscountCodeResource does not have an URITemplate declared on the
>> class. This worked in 0.2.
>>
>> I thought a class is considered a RESTful resource if it contains
>> either URITemplate or HttpMethod annotations,
>>
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>
>