users@jersey.java.net

[Jersey] Exception during Json Return Object

From: johny0704 <johnyse81_at_gmail.com>
Date: Thu, 13 Jan 2011 15:09:42 -0800 (PST)

Hi, I have create simple Json example and getting the below error, can you
plz any one help me


@GET
        @Path("name/{ssoId}")
        @Produces("application/json")
        public User getUser(@PathParam("ssoId") String ssoId) throws JSONException
{
                System.out.println(ssoId);
                User user = new User();
                user.setName("Jani");
                user.setDesc("Hi");
                return user;
        }

@XmlRootElement
public class User implements Serializable {
        
        private String name;
        private String desc;
        /**
         * @return the name
         */
        
        public String getName() {
                return name;
        }
        /**
         * @param name the name to set
         */
        public void setName(String name) {
                this.name = name;
        }
        /**
         * @return the desc
         */
        
        public String getDesc() {
                return desc;
        }
        /**
         * @param desc the desc to set
         */
        public void setDesc(String desc) {
                this.desc = desc;
        }
}

7:42:39,122 ERROR [ContainerBase] Servlet.service() for servlet JAX-RS REST
Servlet threw exception
ava.lang.LinkageError: loader constraints violated when linking
javax/xml/stream/XMLStreamWriter class
       at
com.sun.jersey.json.impl.BaseJSONMarshaller.marshallToJSON(BaseJSONMarshaller.java:100)
       at
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider.writeTo(JSONRootElementProvider.java:111)
       at
com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:149)
       at
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:289)
       at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1029)
       at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
       at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
       at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
       at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
       at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
       at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
-- 
View this message in context: http://jersey.576304.n2.nabble.com/Exception-during-Json-Return-Object-tp5920113p5920113.html
Sent from the Jersey mailing list archive at Nabble.com.