Announcement Announcement Module
Collapse
No announcement yet.
Can not deserialize instance of java.util.Vector out of START_OBJECT token Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can not deserialize instance of java.util.Vector out of START_OBJECT token

    Ok, im trying to receive this kind of JSON

    Code:
    [{"username":"pippo","password":"bla"},{"usernam e": "pluto","password":"bla"},{"username":"topolin o"," password":"bla"}]
    But i receive this error:

    Code:
    Resolving exception from handler [public void sequenziatore.server.presenter.LoginController.Che ckLogin(java.util.Vector<sequenziatore.server.pres enter.Utente>)]: org.springframework.http.converter.HttpMessageNotR eadableException: Could not read JSON: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]
    Resolving exception from handler [public void sequenziatore.server.presenter.LoginController.Che ckLogin(java.util.Vector<sequenziatore.server.pres enter.Utente>)]: org.springframework.http.converter.HttpMessageNotR eadableException: Could not read JSON: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]
    Resolving exception from handler [public void sequenziatore.server.presenter.LoginController.Che ckLogin(java.util.Vector<sequenziatore.server.pres enter.Utente>)]: org.springframework.http.converter.HttpMessageNotR eadableException: Could not read JSON: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.Vector out of START_OBJECT token
    at [Source: [email protected] c40ef9; line: 1, column: 1]
    And this is the controller that im using :

    Code:
    @Controller
    @RequestMapping(value = "/login")
    public class LoginController {
    @RequestMapping(method=RequestMethod.POST, consumes = "application/json", produces = "application/json")
    @ResponseBody
    public void CheckLogin(@RequestBody Vector<Utente> vec) {
    .....
    }
    I tried to change the type that i receive with Utente[] instead of Vector<Utente> but nothing changed, and the real problem is that i don t understand what the error is...
    This is the JSON that i receive if i change the receiving type in String and print it...

    Code:
    {"0":{"username":"pippo","password":"bla"},"1": {"u sername":"pluto","password":"bla"},"2":{"username" :"topolino","password":"bla"}}

  • #2
    This question has been asked on StackOverflow.

    The forums are moving to stackoverflow, a page explaining all this will be available soon: http://spring.io/questions

    Comment


    • #3
      In fact it is mine...But i was hoping here someone could help me...

      Comment

      Working...
      X