title: Spring RESTful service returns 500 internal server error
body: <p>I'm posting to a Spring REST endpoint using angularjs $http service. It's quite straight forward and it works as expected but the end-point is returning status code 500 internal error. But at the server side, it doesn't show any error and exception. I'm sending post request as follow</p>
  
  <pre><code>$http.post('../bookmarks/add',data,{
          cache:false,
          headers:{'Content-Type':'application/x-www-form-urlencoded'},
          transformRequest:function(data){
              if(data===undefined)
                  return data;
  
              return $.param(data);
          },
          responseType:'json'
      }).success(function(data,status,headers,config){
          $('.add-form').hide();
          console.log(data);
          callback(data,'success');
      }).error(function(data,status,headers,config){
          console.log(status);
          if(status==500)
              callback('Server error! Try again later.','error');
      });
  </code></pre>
  
  <p>I am able to send post request. My REST handler is as follow. It invokes a service to persist an object. </p>
  
  <pre><code>@RequestMapping(value="/add", method=RequestMethod.POST, consumes={"application/x-www-form-urlencoded","application/json", "text/plain", "*/*"})
  @ResponseStatus(HttpStatus.OK)
  @ResponseBody
  public Bookmark saveBookmarks(@RequestParam("caption") String caption,@RequestParam("bookmarkUrl") String bookmarkUrl,
          @RequestParam(value="tags",required=false) String tags,@RequestParam(value="category", required=false) String category){
      System.out.println(caption+"-"+tags+"-"+category);
  
      //calling service and persisting the object
      Bookmark bookmark= bookmakService.saveBookmark(
              binder.getNewBookmark(caption,bookmarkUrl, dateGen.getToday(), category, tags)
              ,getUserIDFromSession());
  
      System.out.println(bookmark);
      return bookmark;
  }
  </code></pre>
  
  <p>The above handler works as expected. The object is persisted. But the browser console shows 500 internal server error and the server doesn't log any error and exception. Everything looks straight forward. I don't know why the client is getting the 500 error. I'm using Apache Tomcat 7.</p>