// http://localhost:1085/Spring3HibernateOSGi/index // and not // http://localhost:8080/Spring3HibernateOSGi/index // 1085 is what is set in the arguments // Spring3HibernateOSGi is what is set in service.registerServlet("/Spring3HibernateOSGi", // servlet, initparam, null); in Activator.java // if @ResponseBody is not mentioned, spring will search for a jsp file with that value present in // the return string @RequestMapping("/index") public @ResponseBody String listContacts() { List<Contact> contacts = contactService.listContact(); Gson gson = new Gson(); return gson.toJson(contacts); }