Hi On Mon, Jan 10, 2011 at 10:35 PM, Silverfox <[email protected]> wrote:
> > I have recently started using CXF to create a restful service that returns > JSON output. > > Having first created a simple Hello World service to ensure my > configuration > was correct I then went on to elaborate the service. My next step was to > return a simple POJO called Client that simply contained String properties > for firstName, surname and a Date property for createdDate. The object > being > returned was instantiated using the new operator and this was working fine > having. The class had been annotated using JAXB annotations. > > My next step was to retrieve the object from the database using Hibernate, > it is at this point that I am currently having problems. The object is > returned from the DAO however it has been enhanced by CGLIB so does not > appear to be recognised at this point I get the message: > > 09-Jan-2011 20:47:03 org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor > writeResponseErrorMessage > WARNING: No message body writer has been found for response class > Client$$EnhancerByCGLIB$$604e17d1. > > I'm going to commit some fixes shortly, however, what you can do right now is to extend a default JSONProvider and override its writeTo and isWriteable methods, downcast a (CGLIB created) Class parameter to a more concrete class using this call : org.apache.cxf.common.util.ClassHelper.getRealClassFromClass(cls) where 'cls' is the name of the Class parameter passed to these 2 methods. And finally delegate to the superclass for it to finish isWriteable() or writeTo(). Hope it helps, Sergey > I am using the following: > Tomcat 6.0 > Hibernate 3 > CXF 2.3.1 > Spring 3.0.5 > > If anyone could advise of the best why to solve this problem I would be > grateful. > > Regards > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Using-Hibernate-results-in-No-message-body-writer-found-tp3335611p3335611.html > Sent from the cxf-user mailing list archive at Nabble.com. >
