Thursday 28 January 2016

Failed to load resource: the server responded with a status of 406 (Not Acceptable) in spring mvc ajax call

This error can be solve by these tricks .

1. use @EnableWebMvc with  spring 4.0 or above.

 @Controller
@EnableWebMvc
@RequestMapping(value = "/articles/action",  produces="application/json")
public class UserController {

}


2. use  produces="application/json" in @RequestMapping


3. add these dependency or jar if missing

<dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.2.3</version>
    </dependency>

4 comments:

  1. Superb i really enjoyed very much with this article here. Really its a amazing article i had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.


    SAP training in Chennai

    ReplyDelete
  2. First is to thank you for all this informative posts you give us for free; i bet all of us are happy.
    Such a great idea of yours! You have been a big help for me. Thanks a lot. more post for interesting topic. Great!

    SAP training in Chennai

    ReplyDelete
  3. Everything is fine, am happy about your blog. Thanks admin for sharing the unique content, you have done a great job I appreciate your effort and I hope you will get more positive comments from the web users.


    SAP training in Chennai

    ReplyDelete