title: Could not initialize class org.springframework.web.context.request.ServletRequestAttributes
body: <p>I'm trying to create a Rest controller using Spring 4. I'm also using mongodb as a database, and Tomcat 7 as webserver.
  I'm getting this error message when i try to submit any Rest request:</p>
  
  <pre><code>    type Exception report
  
  message Servlet execution threw an exception
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  javax.servlet.ServletException: Servlet execution threw an exception
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  root cause
  
  java.lang.NoClassDefFoundError: Could not initialize class org.springframework.web.context.request.ServletRequestAttributes
      org.springframework.web.servlet.FrameworkServlet.buildRequestAttributes(FrameworkServlet.java:996)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:923)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  note The full stack trace of the root cause is available in the Apache Tomcat/7.0.56 logs.
  </code></pre>
  
  <p>I'm using those version in my pom.xml</p>
  
  <pre><code>&lt;!-- Web --&gt;
      &lt;jsp.version&gt;2.2&lt;/jsp.version&gt;
      &lt;jstl.version&gt;1.2&lt;/jstl.version&gt;
      &lt;servlet.version&gt;2.5&lt;/servlet.version&gt;
  
      &lt;!-- Spring --&gt;
      &lt;spring-framework.version&gt;4.0.0.RELEASE&lt;/spring-framework.version&gt;
  
      &lt;!-- spring-web --&gt;
      &lt;spring-web.version&gt;4.1.2.RELEASE&lt;/spring-web.version&gt;
  
      &lt;!-- Spring data for MongoDB --&gt;
      &lt;springframework.data-version&gt;1.6.1.RELEASE&lt;/springframework.data-version&gt;
  </code></pre>
  
  <p>here is the controller class that'm using :</p>
  
  <pre><code>@RestController
  @RequestMapping("/rest/user")
  public class UserContoller {
  
      @Autowired
      UserServices userServices;
  
      @RequestMapping(value = "/{username}", method = RequestMethod.GET)
      public @ResponseBody User findUserByUsername(@PathVariable ("username") String username){
          return userServices.findUserByUsername(username);
  
      }
  
  }
  </code></pre>
  
  <p>would you please help me?
  thank you in advance</p>