Guest User

Untitled

a guest
Jan 17th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. com.sun.jersey.api.client.UniformInterfaceException
  2. Message: GET http://localhost:8080/shumer/rest/employee/get returned a response status of 404
  3.  
  4. <servlet>
  5. <servlet-name>JAX-RS Servlet</servlet-name>
  6. <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
  7. <init-param>
  8. <param-name>spring.autowire</param-name>
  9. <param-value>byName</param-value>
  10. </init-param>
  11. <load-on-startup>3</load-on-startup>
  12. </servlet>
  13. <servlet-mapping>
  14. <servlet-name>JAX-RS Servlet</servlet-name>
  15. <url-pattern>/rest/*</url-pattern>
  16. </servlet-mapping>
  17.  
  18. @Path("employee")
  19. public class EmployeeResource {
  20.  
  21. @Autowired
  22. EmpDao empDao;
  23.  
  24. @GET
  25. @Produces(MediaType.APPLICATION_JSON)
  26. public List<Employee> get(@QueryParam("empCode") String empCode) throws Exception {
  27.  
  28. EmpCriteria criteria = new EmpCriteria();
  29. criteria.setEmpCode(empCode);
  30.  
  31.  
  32. return empDao.searchByCondition(criteria);
  33. }
  34.  
  35. }
  36.  
  37. public class EmployeeClientTestAction extends Action {
  38.  
  39. @Override
  40. public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
  41. HttpServletResponse response) throws Exception {
  42.  
  43. Client client = Client.create();
  44. WebResource resource = client.resource("http://localhost:8080/shumer/rest/employee/get");
  45.  
  46. String employees= resource.accept(MediaType.APPLICATION_JSON)
  47. .get(String.class);
  48.  
  49. System.out.println(employees);
  50.  
  51. request.setAttribute("employees", employees);
  52.  
  53. return mapping.findForward("successful");
  54. }
  55.  
  56. }
  57.  
  58. <init-param>
  59. <param-name>com.sun.jersey.config.property.packages</param-name>
  60. <param-value>shumer.rest.resource</param-value>
  61. </init-param>
Add Comment
Please, Sign In to add comment