cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object
Date Thu, 04 Jul 2013 10:22:19 GMT

Hi Andrea,

Re your earlier email: no problems about the questions, please keep them 
coming,

Re this issue: do you have other providers registered ? Other than that, 
I can't think of why readFrom is not called

Thanks, Sergey

On 04/07/13 11:15, eanbiso wrote:
> Hi Sergey,
> I've tried this solution: I've add a BodyReader at clientSide to manage the
> response from the server.
> I've added this provider:
>
> @Provider
> public class StringArrayBodyReader implements MessageBodyReader<String[]> {
> 	
> 		private static final Plat1Logger log = new
> Plat1Logger(StringArrayBodyReader.class);
>
> 		@Override
> 		public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2,
> 				MediaType arg3) {
> 			return String[].class.isAssignableFrom(arg0);
> 		}
>
> 		@Override
> 		public String[] readFrom(Class<String[]> arg0, Type arg1,
> 				Annotation[] arg2, MediaType arg3,
> 				MultivaluedMap<String, String> arg4, InputStream arg5)
> 				throws IOException, WebApplicationException {
> 			// TODO Auto-generated method stub
> 			return null;
> 		}
> }
>
> at the loading of the REST endPoints:
>
> 		JAXRSClientFactoryBean proxyFactory = new JAXRSClientFactoryBean();
> 		proxyFactory.setServiceClass(clazz);
> 		proxyFactory.setAddress(address);
> 		proxyFactory.setProvider(new StringArrayBodyReader());
>
> by the client application.
> Debugging I've seen that when I call a REST web method from the client I
> arrive in the isReadable method of the provider and it returns true only if
> the return type is a String[].... but I' m not yet able to arrive in the
> readFrom method of the provider (this even if the isReadable has returned a
> true value).
> Do you know why this happens?
> And how can I fix it and force to call the readFrom method when isReadable
> returns true?
> In this way I hope to solve the problem.
> 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-tp5730141p5730271.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

Mime
View raw message