your conf is read, the point is by default it is jaxb serialization which
is used (not with jackson) so
https://github.com/jeluard/tomee-rest-json/blob/master/src/main/java/Service.java
can't
return a list (needs to be wrapped with a jaxb object)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/11 Julien Eluard <[email protected]>

> Hi,
>
> I uploaded a case reproducing what I see here:
> https://github.com/jeluard/tomee-rest-json
>
> If someone could take a look at it that would be greatly appreciated.
>
> Thanks!
> Julien
>
>
> 2013/4/11 Julien Eluard <[email protected]>
>
> > Hi,
> >
> > well not sure why but I can't get it to work. Tried various combination
> > but no luck. At this stage I am very close to JeBlog.
> > Is there some configuration to be done at tomee level? I'm using default
> > JAX-RS 1.5.1 edition.
> >
> > Actually I am wondering if my openejb-jar.xml file is read at all (using
> > non existing class for cxf.jaxrs.providers values silently fail).
> > Can I enable more logging there somehow?
> >
> > Also I tried to package JeBlog but compilation fails: it looks like
> latest
> > deltaspike snapsshot has a different API.
> >
> > Thanks!
> >
> >
> > 2013/4/11 Romain Manni-Bucau <[email protected]>
> >
> >> just do it explicitely, the auto discovering works fine when you don't
> use
> >> default media types but for defaults you will probably get some conflict
> >> between jackson and cxf.
> >>
> >> here is a sample:
> >>
> >>
> https://github.com/rmannibucau/JeBlog/blob/rest/src/main/webapp/WEB-INF/openejb-jar.xml
> >>  and
> >>
> >>
> https://github.com/rmannibucau/JeBlog/blob/rest/src/main/webapp/WEB-INF/resources.xml
> >>
> >> it uses cxf json provider but basically replace it by your own one (and
> >> for
> >> attributes ensure you have setters for them) and it should work
> >>
> >> *Romain Manni-Bucau*
> >> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> >> *Blog: **http://rmannibucau.wordpress.com/*<
> >> http://rmannibucau.wordpress.com/>
> >> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >> *Github: https://github.com/rmannibucau*
> >>
> >>
> >>
> >> 2013/4/11 Julien Eluard <[email protected]>
> >>
> >> > Hi Romain,
> >> >
> >> > thanks for the answer.
> >> >
> >> > Do you have a little more pointer? I tried some things in that
> direction
> >> > but couldn't get anything working. Not even meaningful logs and/or
> >> > exception.
> >> > I guess in my case using Jackson would be the best option. How can I
> >> have
> >> > the Jackson MessageBodyReader/Writer discovered (they are already
> >> defined
> >> > as services)? Isn't what 'openejb.jaxrs.providers.auto=true' is
> >> supposed to
> >> > do?
> >> >
> >> > I am willing to spend some time improving one of tomee rest example.
> >> Looks
> >> > like it's such a basic use case it should be dead easy to get working.
> >> >
> >> > Julien
> >> >
> >> >
> >> > 2013/4/11 Romain Manni-Bucau <[email protected]>
> >> >
> >> > > Well, there isnt a unique solution. Basically it works out of the
> box
> >> > using
> >> > > jaxb annotations on your pojo.
> >> > >
> >> > > That said here is the best compromise to get a good control:
> >> > > * create a custom @Provider delegating to jackson (added in the
> >> webapp)
> >> > > * configure it in openejb-jar.xml
> >> > >
> >> > > Thats the easiest provider to use and clearly the fastest
> >> > > Le 11 avr. 2013 02:20, "Julien Eluard" <[email protected]> a
> >> > écrit :
> >> > >
> >> > > > Hi,
> >> > > >
> >> > > > when trying to send a List of POJOs (as application/json) via
> >> JAX-RS I
> >> > > get
> >> > > > the infamous:
> >> > > > WARNING: No message body writer has been found for response class
> >> List.
> >> > > >
> >> > > > Googling around I can find several suggestions to fix that
> (setting
> >> > some
> >> > > > Java properties, using Jackson, introducing an openejb-jar.xml).
> >> None
> >> > > work
> >> > > > and it looks like the solution evolved over time.
> >> > > > What is the correct way to solve this with Tomee 1.5.1 JAX-RS
> >> edition?
> >> > > > Although is there a good reason this cannot be supported
> >> > out-of-the-box?
> >> > > > That's a little frustrating..
> >> > > >
> >> > > > I can make things kind of work using XMLRootElement on my POJO but
> >> > then I
> >> > > > have a extra JSON level whose name is derived from my Class name.
> >> Kind
> >> > of
> >> > > > ugly.
> >> > > >
> >> > > > Thanks!
> >> > > > Julien
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>

Reply via email to