Hi

I'm not sure attempting to map a byte[] array to a query parameter will work, but I guess no ClassCastException should be reported but something more meaningful, I'll try to have to look into it.
In meantime, try Byte[]. may be that will help

Sergey
On 01/07/13 16:22, eanbiso wrote:
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



--
View this message in context: 
http://cxf.547215.n5.nabble.com/java-lang-ClassCastException-B-cannot-be-cast-to-Ljava-lang-Object-tp5730141.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Reply via email to