You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Julien Eluard <ju...@gmail.com> on 2013/04/11 02:19:57 UTC

JSON serialization

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

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
think 1.5.2 doesn't deploy the exact same way so it should be configured by
endpoint instead of application class (IIRC, no more sure :s)

*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 <ju...@gmail.com>

> I can confirm it works as expected with latest 1.6 SNAPSHOT. I also tried
> with 1.5.2 (which has apparently been released to maven central?) and it
> does not work with a small variation: I now get following message
> No message body writer has been found for response class SingletonList.
>
> Thanks again Romain for the help!
> Julien
>
>
> 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
>
> > yes, as usually that's here
> >
> >
> https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.6.0-SNAPSHOT/
> >
> > *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 <ju...@gmail.com>
> >
> > > Ah ok I will give it a try. Are there any JAX-RS distribution available
> > for
> > > the snapshot?
> > >
> > >
> > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > works fine on the snapshot
> > > >
> > > > *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 <ju...@gmail.com>
> > > >
> > > > > Still the same issue.
> > > > >
> > > > >
> > > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
> > > > > >
> > > > > > *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 <ju...@gmail.com>
> > > > > >
> > > > > > > >the point is by default it is jaxb serialization which is used
> > > (not
> > > > > with
> > > > > > > jackson)
> > > > > > > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB
> > and
> > > > thus
> > > > > > > expects XmlRootElement right? Ok I don't want that.
> > > > > > >
> > > > > > > So I have to switch to something
> > > > > > > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now
> > even
> > > > > after
> > > > > > > having added Jackson jars
> > > > > > > (jackson-annotations, jackson-core, jackson-databind
> > > > > > > and jackson-jaxrs-json-provider) in tomee/lib I still get the
> > same
> > > > > > message.
> > > > > > >
> > > > > > > Even trying with a random string as Service/class-name does not
> > > > trigger
> > > > > > any
> > > > > > > error/exception . How can I get come more info? It makes the
> > whole
> > > > > thing
> > > > > > > really hard to debug as I essentially have no idea what is
> wrong:
> > > my
> > > > > conf
> > > > > > > file, it's location, content.. Whole configuration process
> isn't
> > > > > exactly
> > > > > > > straightforward.
> > > > > > >
> > > > > > > As a side note I really appreciate tomee and the hard work you
> > guys
> > > > put
> > > > > > > into it!
> > > > > > >
> > > > > > > Thanks!
> > > > > > >
> > > > > > >
> > > > > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > 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 <ju...@gmail.com>
> > > > > > > >
> > > > > > > > > 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 <ju...@gmail.com>
> > > > > > > > >
> > > > > > > > > > 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 <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > >> 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 <ju...@gmail.com>
> > > > > > > > > >>
> > > > > > > > > >> > 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 <rm...@gmail.com>
> > > > > > > > > >> >
> > > > > > > > > >> > > 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" <
> > > > > > julien.eluard@gmail.com
> > > > > > > >
> > > > > > > > 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
> > > > > > > > > >> > > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
I can confirm it works as expected with latest 1.6 SNAPSHOT. I also tried
with 1.5.2 (which has apparently been released to maven central?) and it
does not work with a small variation: I now get following message
No message body writer has been found for response class SingletonList.

Thanks again Romain for the help!
Julien


2013/4/11 Romain Manni-Bucau <rm...@gmail.com>

> yes, as usually that's here
>
> https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.6.0-SNAPSHOT/
>
> *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 <ju...@gmail.com>
>
> > Ah ok I will give it a try. Are there any JAX-RS distribution available
> for
> > the snapshot?
> >
> >
> > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > works fine on the snapshot
> > >
> > > *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 <ju...@gmail.com>
> > >
> > > > Still the same issue.
> > > >
> > > >
> > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
> > > > >
> > > > > *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 <ju...@gmail.com>
> > > > >
> > > > > > >the point is by default it is jaxb serialization which is used
> > (not
> > > > with
> > > > > > jackson)
> > > > > > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB
> and
> > > thus
> > > > > > expects XmlRootElement right? Ok I don't want that.
> > > > > >
> > > > > > So I have to switch to something
> > > > > > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now
> even
> > > > after
> > > > > > having added Jackson jars
> > > > > > (jackson-annotations, jackson-core, jackson-databind
> > > > > > and jackson-jaxrs-json-provider) in tomee/lib I still get the
> same
> > > > > message.
> > > > > >
> > > > > > Even trying with a random string as Service/class-name does not
> > > trigger
> > > > > any
> > > > > > error/exception . How can I get come more info? It makes the
> whole
> > > > thing
> > > > > > really hard to debug as I essentially have no idea what is wrong:
> > my
> > > > conf
> > > > > > file, it's location, content.. Whole configuration process isn't
> > > > exactly
> > > > > > straightforward.
> > > > > >
> > > > > > As a side note I really appreciate tomee and the hard work you
> guys
> > > put
> > > > > > into it!
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > >
> > > > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > 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 <ju...@gmail.com>
> > > > > > >
> > > > > > > > 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 <ju...@gmail.com>
> > > > > > > >
> > > > > > > > > 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 <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > >> 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 <ju...@gmail.com>
> > > > > > > > >>
> > > > > > > > >> > 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 <rm...@gmail.com>
> > > > > > > > >> >
> > > > > > > > >> > > 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" <
> > > > > julien.eluard@gmail.com
> > > > > > >
> > > > > > > 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
> > > > > > > > >> > > >
> > > > > > > > >> > >
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yes, as usually that's here
https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.6.0-SNAPSHOT/

*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 <ju...@gmail.com>

> Ah ok I will give it a try. Are there any JAX-RS distribution available for
> the snapshot?
>
>
> 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
>
> > works fine on the snapshot
> >
> > *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 <ju...@gmail.com>
> >
> > > Still the same issue.
> > >
> > >
> > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
> > > >
> > > > *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 <ju...@gmail.com>
> > > >
> > > > > >the point is by default it is jaxb serialization which is used
> (not
> > > with
> > > > > jackson)
> > > > > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and
> > thus
> > > > > expects XmlRootElement right? Ok I don't want that.
> > > > >
> > > > > So I have to switch to something
> > > > > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even
> > > after
> > > > > having added Jackson jars
> > > > > (jackson-annotations, jackson-core, jackson-databind
> > > > > and jackson-jaxrs-json-provider) in tomee/lib I still get the same
> > > > message.
> > > > >
> > > > > Even trying with a random string as Service/class-name does not
> > trigger
> > > > any
> > > > > error/exception . How can I get come more info? It makes the whole
> > > thing
> > > > > really hard to debug as I essentially have no idea what is wrong:
> my
> > > conf
> > > > > file, it's location, content.. Whole configuration process isn't
> > > exactly
> > > > > straightforward.
> > > > >
> > > > > As a side note I really appreciate tomee and the hard work you guys
> > put
> > > > > into it!
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > 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 <ju...@gmail.com>
> > > > > >
> > > > > > > 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 <ju...@gmail.com>
> > > > > > >
> > > > > > > > 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 <rm...@gmail.com>
> > > > > > > >
> > > > > > > >> 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 <ju...@gmail.com>
> > > > > > > >>
> > > > > > > >> > 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 <rm...@gmail.com>
> > > > > > > >> >
> > > > > > > >> > > 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" <
> > > > julien.eluard@gmail.com
> > > > > >
> > > > > > 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
> > > > > > > >> > > >
> > > > > > > >> > >
> > > > > > > >> >
> > > > > > > >>
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
Ah ok I will give it a try. Are there any JAX-RS distribution available for
the snapshot?


2013/4/11 Romain Manni-Bucau <rm...@gmail.com>

> works fine on the snapshot
>
> *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 <ju...@gmail.com>
>
> > Still the same issue.
> >
> >
> > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
> > >
> > > *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 <ju...@gmail.com>
> > >
> > > > >the point is by default it is jaxb serialization which is used (not
> > with
> > > > jackson)
> > > > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and
> thus
> > > > expects XmlRootElement right? Ok I don't want that.
> > > >
> > > > So I have to switch to something
> > > > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even
> > after
> > > > having added Jackson jars
> > > > (jackson-annotations, jackson-core, jackson-databind
> > > > and jackson-jaxrs-json-provider) in tomee/lib I still get the same
> > > message.
> > > >
> > > > Even trying with a random string as Service/class-name does not
> trigger
> > > any
> > > > error/exception . How can I get come more info? It makes the whole
> > thing
> > > > really hard to debug as I essentially have no idea what is wrong: my
> > conf
> > > > file, it's location, content.. Whole configuration process isn't
> > exactly
> > > > straightforward.
> > > >
> > > > As a side note I really appreciate tomee and the hard work you guys
> put
> > > > into it!
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > 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 <ju...@gmail.com>
> > > > >
> > > > > > 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 <ju...@gmail.com>
> > > > > >
> > > > > > > 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 <rm...@gmail.com>
> > > > > > >
> > > > > > >> 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 <ju...@gmail.com>
> > > > > > >>
> > > > > > >> > 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 <rm...@gmail.com>
> > > > > > >> >
> > > > > > >> > > 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" <
> > > julien.eluard@gmail.com
> > > > >
> > > > > 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
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
works fine on the snapshot

*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 <ju...@gmail.com>

> Still the same issue.
>
>
> 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
>
> > try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
> >
> > *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 <ju...@gmail.com>
> >
> > > >the point is by default it is jaxb serialization which is used (not
> with
> > > jackson)
> > > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and thus
> > > expects XmlRootElement right? Ok I don't want that.
> > >
> > > So I have to switch to something
> > > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even
> after
> > > having added Jackson jars
> > > (jackson-annotations, jackson-core, jackson-databind
> > > and jackson-jaxrs-json-provider) in tomee/lib I still get the same
> > message.
> > >
> > > Even trying with a random string as Service/class-name does not trigger
> > any
> > > error/exception . How can I get come more info? It makes the whole
> thing
> > > really hard to debug as I essentially have no idea what is wrong: my
> conf
> > > file, it's location, content.. Whole configuration process isn't
> exactly
> > > straightforward.
> > >
> > > As a side note I really appreciate tomee and the hard work you guys put
> > > into it!
> > >
> > > Thanks!
> > >
> > >
> > > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > 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 <ju...@gmail.com>
> > > >
> > > > > 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 <ju...@gmail.com>
> > > > >
> > > > > > 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 <rm...@gmail.com>
> > > > > >
> > > > > >> 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 <ju...@gmail.com>
> > > > > >>
> > > > > >> > 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 <rm...@gmail.com>
> > > > > >> >
> > > > > >> > > 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" <
> > julien.eluard@gmail.com
> > > >
> > > > 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
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
Still the same issue.


2013/4/11 Romain Manni-Bucau <rm...@gmail.com>

> try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d
>
> *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 <ju...@gmail.com>
>
> > >the point is by default it is jaxb serialization which is used (not with
> > jackson)
> > org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and thus
> > expects XmlRootElement right? Ok I don't want that.
> >
> > So I have to switch to something
> > like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even after
> > having added Jackson jars
> > (jackson-annotations, jackson-core, jackson-databind
> > and jackson-jaxrs-json-provider) in tomee/lib I still get the same
> message.
> >
> > Even trying with a random string as Service/class-name does not trigger
> any
> > error/exception . How can I get come more info? It makes the whole thing
> > really hard to debug as I essentially have no idea what is wrong: my conf
> > file, it's location, content.. Whole configuration process isn't exactly
> > straightforward.
> >
> > As a side note I really appreciate tomee and the hard work you guys put
> > into it!
> >
> > Thanks!
> >
> >
> > 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > 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 <ju...@gmail.com>
> > >
> > > > 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 <ju...@gmail.com>
> > > >
> > > > > 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 <rm...@gmail.com>
> > > > >
> > > > >> 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 <ju...@gmail.com>
> > > > >>
> > > > >> > 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 <rm...@gmail.com>
> > > > >> >
> > > > >> > > 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" <
> julien.eluard@gmail.com
> > >
> > > 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
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
try https://gist.github.com/rmannibucau/a4371909c0bc07e2383d

*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 <ju...@gmail.com>

> >the point is by default it is jaxb serialization which is used (not with
> jackson)
> org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and thus
> expects XmlRootElement right? Ok I don't want that.
>
> So I have to switch to something
> like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even after
> having added Jackson jars
> (jackson-annotations, jackson-core, jackson-databind
> and jackson-jaxrs-json-provider) in tomee/lib I still get the same message.
>
> Even trying with a random string as Service/class-name does not trigger any
> error/exception . How can I get come more info? It makes the whole thing
> really hard to debug as I essentially have no idea what is wrong: my conf
> file, it's location, content.. Whole configuration process isn't exactly
> straightforward.
>
> As a side note I really appreciate tomee and the hard work you guys put
> into it!
>
> Thanks!
>
>
> 2013/4/11 Romain Manni-Bucau <rm...@gmail.com>
>
> > 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 <ju...@gmail.com>
> >
> > > 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 <ju...@gmail.com>
> > >
> > > > 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 <rm...@gmail.com>
> > > >
> > > >> 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 <ju...@gmail.com>
> > > >>
> > > >> > 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 <rm...@gmail.com>
> > > >> >
> > > >> > > 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" <julien.eluard@gmail.com
> >
> > 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
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
>the point is by default it is jaxb serialization which is used (not with
jackson)
org.apache.cxf.jaxrs.provider.json.JSONProvider relies on JAXB and thus
expects XmlRootElement right? Ok I don't want that.

So I have to switch to something
like com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. Now even after
having added Jackson jars
(jackson-annotations, jackson-core, jackson-databind
and jackson-jaxrs-json-provider) in tomee/lib I still get the same message.

Even trying with a random string as Service/class-name does not trigger any
error/exception . How can I get come more info? It makes the whole thing
really hard to debug as I essentially have no idea what is wrong: my conf
file, it's location, content.. Whole configuration process isn't exactly
straightforward.

As a side note I really appreciate tomee and the hard work you guys put
into it!

Thanks!


2013/4/11 Romain Manni-Bucau <rm...@gmail.com>

> 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 <ju...@gmail.com>
>
> > 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 <ju...@gmail.com>
> >
> > > 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 <rm...@gmail.com>
> > >
> > >> 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 <ju...@gmail.com>
> > >>
> > >> > 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 <rm...@gmail.com>
> > >> >
> > >> > > 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" <ju...@gmail.com>
> 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
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <ju...@gmail.com>

> 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 <ju...@gmail.com>
>
> > 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 <rm...@gmail.com>
> >
> >> 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 <ju...@gmail.com>
> >>
> >> > 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 <rm...@gmail.com>
> >> >
> >> > > 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" <ju...@gmail.com> 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
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
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 <ju...@gmail.com>

> 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 <rm...@gmail.com>
>
>> 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 <ju...@gmail.com>
>>
>> > 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 <rm...@gmail.com>
>> >
>> > > 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" <ju...@gmail.com> 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
>> > > >
>> > >
>> >
>>
>
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
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 <rm...@gmail.com>

> 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 <ju...@gmail.com>
>
> > 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 <rm...@gmail.com>
> >
> > > 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" <ju...@gmail.com> 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
> > > >
> > >
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <ju...@gmail.com>

> 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 <rm...@gmail.com>
>
> > 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" <ju...@gmail.com> 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
> > >
> >
>

Re: JSON serialization

Posted by Julien Eluard <ju...@gmail.com>.
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 <rm...@gmail.com>

> 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" <ju...@gmail.com> 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
> >
>

Re: JSON serialization

Posted by Romain Manni-Bucau <rm...@gmail.com>.
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" <ju...@gmail.com> 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
>