Problem solved. Just to share my experiences, looks like when I provide my custom MessageBodyReader or MessageBodyWriter, I also need to make sure that JaxbCollection is also in the same context that I use for marshalling the object.
Thanks, kw On Tue, Sep 13, 2011 at 11:57 AM, kwground kwground <kw1...@gmail.com>wrote: > What's frustrating is that when I do unit test via "BaseResourceTest", > everything works. But when I run it in jboss, MarshalException was thrown. > > Here's sample resource: > > @Path("/api/id") > public class MyIdentityService { > @GET > @Path("info/{ids}") > @Produces("application/xml") > @Wrapped(element = "profiles") > public Response info(@PathParam("ids") String ids) { > ArrayList<Profile> set = new ArrayList<Profile>(); > String[] idds = ids.split(","); > for(String id : idds) > set.add(new Profile(id)); > GenericEntity<List<Profile>> genericEntity = new > GenericEntity<List<Profile>>(set) {}; > return Response.ok(genericEntity).build(); > } > } > @XmlRootElement(name="profile") > public class Profile { > private String id; > > public SocialProfile(String id) { > this.id = id; > } > > @XmlAttribute > public String getId() { > return id; > } > public void setId(String id) { > this.id = id; > } > } > > > > On Mon, Sep 12, 2011 at 9:16 PM, kwground kwground <kw1...@gmail.com>wrote: > >> Hi, >> >> I'm still getting the this SAXException2 when I'm trying to return a list >> of customer objects, folling what Bill's book, and also this link: >> >> http://fandry.blogspot.com/2010/06/response-objects-and-use-genericentity.html >> >> 2011-09-12 21:04:49,093 WARN >> [http-0.0.0.0-80-1:][SynchronousDispatcher] failed to execute >> javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException >> - with linked exception: >> [com.sun.istack.SAXException2: unable to marshal type >> "java.util.ArrayList" as an element because it is missing an @XmlRootElement >> annotation] >> at >> com.tungle.rest.spi.resteasy.plugins.moxy.MOXyMessageBodyReaderWriter.writeTo(MOXyMessageBodyReaderWriter.java:83) >> at >> org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117) >> at >> org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.write(DigitalSigningInterceptor.java:39) >> at >> org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) >> at >> org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:63) >> at >> org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) >> at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250) >> at >> org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:579) >> at >> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:500) >> at >> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) >> at >> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) >> at >> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) >> at >> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) >> >> I googled, but couldn't find a solution. Please help. Thanks, >> > >
------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1
_______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users