Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object

$
0
0
Hi all,
I've a class cast exception invoking a REST web method that wants a byte[]
as input parameter.
I had a SOAP endPoint and I've added all the annotations required to publish
it also with REST technology...
The web method is this:

@POST
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/AddCluster")
@ApiOperation(value = "Create a new cluster", notes = "Returns the newly
created cluster", response = IProxyCluster.class, produces
="application/xml,application/json")
public IProxyCluster AddCluster(
@ApiParam(value = "username", required = true) @WebParam(name =
"username") @QueryParam("username") @CxfWSAuthGrain(type=authType.username)
String username ,
@ApiParam(value = "appGardenID", required = true) @WebParam(name =
"appGardenID") @QueryParam("appGardenID") int appGardenID ,
@ApiParam(value = "clusterLevel", required = true) @WebParam(name =
"clusterLevel") @QueryParam("clusterLevel") short clusterLevel ,
@ApiParam(value = "clusterType", required = true) @WebParam(name =
"clusterType") @QueryParam("clusterType") short clusterType ,
@ApiParam(value = "hopsize", required = true) @WebParam(name = "hopsize")
@QueryParam("hopsize") int hopsize ,
@ApiParam(value = "clusterAddress", required = true) @WebParam(name =
"clusterAddress") @QueryParam("clusterAddress") byte[] clusterAddress ,
@ApiParam(value = "name", required = true) @WebParam(name = "name")
@QueryParam("name") String name ,
@ApiParam(value = "description", required = true) @WebParam(name =
"description") @QueryParam("description") String description ) throws
DBValidationException;

When I call the REST web method on client side this exception occurs:

[01 lug 2013 17:03:14,728] - (TestWS-383) ERROR Exception:
java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
at
org.apache.cxf.jaxrs.client.AbstractClient.addMatrixQueryParamsToBuilder(AbstractClient.java:632)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.handleQueries(ClientProxyImpl.java:432)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:162)
at $Proxy33.AddCluster(Unknown Source)

...debugging I've found that the parameter that is the cause of the trouble
is the "byte[] clusterAddress"

How can I fix the problem?
I forgot a few annotations?
I'm using cxf_2.7.3
Thanks a lot,

Andrea

Viewing all articles
Browse latest Browse all 5648

Trending Articles