You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ari King <ar...@gmail.com> on 2011/12/14 20:28:04 UTC

Unrecognised Field WebApplicationException

When I try to execute a PUT against http://localhost:8080/users/{id} I get:

WARNING: WebApplicationException has been caught : Unrecognized field
"id" (Class com.ws.dto.UserDto), not marked as ignorable
 at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@1e0969b;
line: 1, column: 8] (through reference chain:
com.ws.dto.UserDto["id"])

Does anyone know what the problem is and how to resolve it?

Below is the relevant class:

@PUT
@Path("/{id}")
@Consumes("application/json")
@Transactional
public Response update(@PathParam("id") Long id, UserDto userDto) {
...
}

Thanks.

-Ari

Re: Unrecognised Field WebApplicationException

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 14/12/11 19:28, Ari King wrote:
> When I try to execute a PUT against http://localhost:8080/users/{id} I get:
>
> WARNING: WebApplicationException has been caught : Unrecognized field
> "id" (Class com.ws.dto.UserDto), not marked as ignorable
>   at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@1e0969b;
> line: 1, column: 8] (through reference chain:
> com.ws.dto.UserDto["id"])
>
> Does anyone know what the problem is and how to resolve it?

Seems Jackson related:
http://stackoverflow.com/questions/4486787/jackson-json-unrecognized-field-not-marked-as-ignorable

With Jettison it's possible to use a CXF Transform feature to block 
individual fields,

Cheers, Sergey

>
> Below is the relevant class:
>
> @PUT
> @Path("/{id}")
> @Consumes("application/json")
> @Transactional
> public Response update(@PathParam("id") Long id, UserDto userDto) {
> ...
> }
>
> Thanks.
>
> -Ari


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Re: Unrecognised Field WebApplicationException

Posted by Ari King <ar...@gmail.com>.
> When I try to execute a PUT against http://localhost:8080/users/{id} I get:
>
> WARNING: WebApplicationException has been caught : Unrecognized field
> "id" (Class com.ws.dto.UserDto), not marked as ignorable
>  at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@1e0969b;
> line: 1, column: 8] (through reference chain:
> com.ws.dto.UserDto["id"])
>
> Does anyone know what the problem is and how to resolve it?
>
> Below is the relevant class:
>
> @PUT
> @Path("/{id}")
> @Consumes("application/json")
> @Transactional
> public Response update(@PathParam("id") Long id, UserDto userDto) {
> ...
> }
>
> Thanks.
>
> -Ari

I don't believe this is the issue, but I have another resource method,
which shares the same path

i.e. http://localhost:8080/users/{id}:

@GET
@Path("/{id}")
@Produces("application/json")
@Transactional(readOnly=true)
public Response show(@PathParam("id") int id) {
...
}