users@jersey.java.net

[Jersey] class org.codehaus.jettison.json.JSONObject, and MIME media type, application/json, was not found

From: johny0704 <johnyse81_at_gmail.com>
Date: Wed, 12 Jan 2011 20:38:31 -0800 (PST)

Hi I am returning JSONObject and getting the

23:35:57,890 SEVERE [ContainerResponse] A message body writer for Java type,
class org.codehaus.jettison.json.JSONObject, and MIME media type,
application/json, was not found

Can you please help me on this.

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

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;
        }
}

-- 
View this message in context: http://jersey.576304.n2.nabble.com/class-org-codehaus-jettison-json-JSONObject-and-MIME-media-type-application-json-was-not-found-tp5917106p5917106.html
Sent from the Jersey mailing list archive at Nabble.com.