Topic
3 replies Latest Post - ‏2011-12-19T08:38:26Z by SystemAdmin
SystemAdmin
SystemAdmin
34 Posts
ACCEPTED ANSWER

Pinned topic RESTful Web services: The basics

‏2011-01-10T16:25:38Z |
Greetings:

A comment posted on 1/10/11 into this article should be moved to an appropriate support forum. When possible, please remove?

Article Title: RESTful Web services: The basics
Article Link: http://www.ibm.com/developerworks/webservices/library/ws-restful/index.html

Comment to be removed:

Comment:

When I'm trying to run GET for employee/1 i.e. http://localhost:8080/rest/service/employee/1 I get following error even though the employee object is not null?

10:51:00,215 INFO http-8080-2 controller.EmployeeController:42 - >>>>>>>Employee ID passed is : 1
10:51:00,215 INFO http-8080-2 controller.EmployeeController:45 - <<<<<<<Employee record returned is : Name - Huang Yi Ming, Email - huangyim@cn.ibm.com
10:51:00,215 DEBUG http-8080-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'employees'
Jan 10, 2011 10:51:00 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet rest threw exception
javax.servlet.ServletException: Unable to locate object to be marshalled in model: {org.springframework.validation.BindingResult.object=org.springframework.validation.BeanPropertyBindingResult: 0 errors, object=com.sample.rest.bean.Employee@82254d}
at org.springframework.web.servlet.view.xml.MarshallingView.renderMerged

Comment created by: Parvinder
Comment date: 2011-01-10 10:57:11
Comment:

When I'm trying to run GET for employee/1 i.e. http://localhost:8080/rest/service/employee/1 I get following error even though the employee object is not null?

10:51:00,215 INFO http-8080-2 controller.EmployeeController:42 - >>>>>>>Employee ID passed is : 1
10:51:00,215 INFO http-8080-2 controller.EmployeeController:45 - <<<<<<<Employee record returned is : Name - Huang Yi Ming, Email - huangyim@cn.ibm.com
10:51:00,215 DEBUG http-8080-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'employees'
Jan 10, 2011 10:51:00 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet rest threw exception
javax.servlet.ServletException: Unable to locate object to be marshalled in model: {org.springframework.validation.BindingResult.object=org.springframework.validation.BeanPropertyBindingResult: 0 errors, object=com.sample.rest.bean.Employee@82254d}
at org.springframework.web.servlet.view.xml.MarshallingView.renderMerged

Comment created by: Parvinder
Comment date: 2011-01-10 10:57:11
Updated on 2011-12-19T08:38:26Z at 2011-12-19T08:38:26Z by SystemAdmin
  • john.holtman
    john.holtman
    25 Posts
    ACCEPTED ANSWER

    Re: RESTful Web services: The basics

    ‏2011-01-10T17:31:23Z  in response to SystemAdmin
    This has been taken care of.

    John Holtman
    developerWorks Team
    • JavaDev24
      JavaDev24
      1 Post
      ACCEPTED ANSWER

      Re: RESTful Web services: The basics

      ‏2011-01-19T09:09:04Z  in response to john.holtman
      Can you pls publish the solution for this problem. I am getting the same problem in my spring rest WS with Jaxb.
  • SystemAdmin
    SystemAdmin
    34 Posts
    ACCEPTED ANSWER

    Re: RESTful Web services: The basics

    ‏2011-12-19T08:38:26Z  in response to SystemAdmin
    i have the same problem too on windows XP
    when i use:

    curl –HAccept:application/xml http://localhost:8080/Spring3Restful/service/employees/

    16:39:46,081 DEBUG DispatcherServlet:636 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1419df2
    16:39:46,081 DEBUG DispatcherServlet:640 - Could not complete request
    javax.servlet.ServletException: Unable to locate object to be marshalled in model: {org.springframework.validation.BindingResult.employees=org.springframework.validation.BeanPropertyBindingResult: 0 errors, employees=dw.spring3.rest.bean.EmployeeList@103c1a5}
    at org.springframework.web.servlet.view.xml.MarshallingView.renderMergedOutputModel(MarshallingView.java:100)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1062)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:709)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:613)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)