Spring: The request sent by the client was syntactically incorrect ()

后端 未结 4 1610
无人共我
无人共我 2020-12-14 18:17

Hi I received next error during the redirect:

The request sent by the client was syntactically incorrect

URL which browser show

相关标签:
4条回答
  • 2020-12-14 18:45

    In my case, it was also a problem of conversion, Spring was expecting an Integer however I was entering a String. Try to check what you have passed as parameters to the controller

    0 讨论(0)
  • 2020-12-14 18:49

    In my case the reason of this error was that browser (Chrome, in my particular case) was sending the date from the <input type="date" ... /> to the server in the wrong format so server didn't know how to parse it.

    0 讨论(0)
  • 2020-12-14 18:59

    In cases like this it is very useful to have org.springframework.web loggin level set to DEBUG in log4j configuration

    <logger name="org.springframework.web">
        <level value="DEBUG" />
        ...
    </logger>
    

    E.g. when parameter is missing or cannot be converted to the required type there will be an exception details in the log.

    0 讨论(0)
  • 2020-12-14 19:10

    As said ike3, using the detailed log aided a lot to find the solution for me. In my case it was a mismatch between @PathVariable without name specified, and the variable itself.

    Something like this:

    @RequestMapping("/user/{uname}")
    public String doSomething(@PathVariable String username) { ...
    

    Note the difference between "uname" and "username" ! There was an exception internally that wasn't raised and I couldn't see it until I set the log to INFO level.

    0 讨论(0)
提交回复
热议问题