I didnt try to be honest...but basically the serialization is the same so the issue should be somewhere else Le 12 mars 2013 06:03, "Patel, Sanjay" <[email protected]> a écrit :
> Do you get same error on 1.5.1? > > -----Original Message----- > From: Romain Manni-Bucau [mailto:[email protected]] > Sent: Monday, March 11, 2013 4:52 PM > To: [email protected] > Subject: Re: issue with REST service > > works fine on the snapshot > > i just added to the pom in build section the plugin: > > <plugin> > <groupId>org.apache.openejb.maven</groupId> > <artifactId>tomee-maven-plugin</artifactId> > <version>1.6.0-SNAPSHOT</version> > <configuration> > <tomeeClassifier>jaxrs</tomeeClassifier> > <simpleLog>true</simpleLog> > </configuration> > </plugin> > > > then ran mvn tomee:run > > *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/3/11 Patel, Sanjay <[email protected]> > > > See attached Project and war. > > > > Deploy war to tome 1.5.1. > > > > http://localhost:8080/test/secure/rest/one works > > > > http://localhost:8080/test/secure/rest/two does not work > > > > > > > > -----Original Message----- > > From: Romain Manni-Bucau [mailto:[email protected]] > > Sent: Monday, March 11, 2013 2:57 PM > > To: [email protected] > > Subject: Re: issue with REST service > > > > Any way to reproduce it? > > > > Not sure the generics help > > Le 11 mars 2013 19:51, "Patel, Sanjay" <[email protected]> a > > écrit > > : > > > > > I have simple REST service. It returns list of entity. (e.g. Event) > > > > > > @GET > > > @Path("/events") > > > @Produces({ "application/json" }) > > > public List<Event> findEvents() { > > > return eventBean.findEvents().getList(); > > > } > > > > > > > > > It works fine if return type is List<Event>. If I change it to > > > EntityDTO (which contains list of Event and int property as shown > > > below), it gives below error. > > > > > > EntityDTO.java > > > @XmlRootElement > > > @XmlSeeAlso({ Event.class }) > > > public class EntityDTO<E> { > > > > > > private List<E> list; > > > private int totalCount; > > > > > > public List<E> getList() { > > > return list; > > > } > > > > > > public void setList(List<E> list) { > > > this.list = list; > > > } > > > > > > public int getTotalCount() { > > > return totalCount; > > > } > > > > > > public void setTotalCount(int totalCount) { > > > this.totalCount = totalCount; > > > } > > > > > > } > > > > > > This is the error I get. > > > WARNING: javax.ws.rs.WebApplicationException: > > > java.lang.NullPointerException > > > at > > > org.apache.cxf.jaxrs.provider.json.JSONProvider.writeTo(JSONProvider > > > .j > > > ava:370) > > > at > > > org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.writeTo(JAXRSOu > > > tI > > > nterceptor.java:298) > > > at > > > org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessag > > > e( > > > JAXRSOutInterceptor.java:258) > > > at > > > org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse > > > (J > > > AXRSOutInterceptor.java:146) > > > at > > > org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(J > > > AX > > > RSOutInterceptor.java:84) > > > at > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep > > > to > > > rChain.java:262) > > > at > > > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Ou > > > tg > > > oingChainInterceptor.java:77) > > > at > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep > > > to > > > rChain.java:262) > > > at > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInit > > > ia > > > tionObserver.java:121) > > > at > > > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(Abstrac > > > tH > > > TTPDestination.java:236) > > > at > > > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHt > > > tp > > > Listener.java:70) at > > > org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53) > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) > > > at > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App > > > li > > > cationFilterChain.java:305) > > > at > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(Application > > > Fi > > > lterChain.java:210) > > > at > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain > > > .d > > > oFilter(FilterChainProxy.java:330) > > > at > > > org.springframework.security.web.access.intercept.FilterSecurityInte > > > rc > > > eptor.invoke(FilterSecurityInterceptor.java:118) > > > at > > > org.springframework.security.web.access.intercept.FilterSecurityInte > > > rc > > > eptor.doFilter(FilterSecurityInterceptor.java:84) > > > > > > > > > What am I missing? Any help would be appreciated. > > > > > > Thanks. > > > > > >
