No, you don’t need to change the signature. When you set the response result into the message body, you need to wrap the result into a List just like this
List<Book> books ... List<Object> resultList = new ArrayList<Object>(); resultList.add(books); exchange.getOut().setBody(resultList); -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On January 2, 2014 at 8:45:33 PM, sanjbh (san...@gmail.com) wrote: > > Willem, > > I tried changing the signature to List> getBooks(); > but that > didn't work. So I tried creating a wrapper class that wraps the > List > and named it Books and changed the method to Books getBooks(). > But still I > am getting the ClassCastException as follows: > > org.apache.cxf.interceptor.Fault: org.test.cxfws.domain.Book > cannot be cast > to org.test.cxfws.domain.Books > > Thanks. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Getting-ClassCastException-in-Camel-route-while-handling-response-containing-java-util-List-tp5745393p5745434.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >