title: A message body writer for Java type was not found mime type application/x-www-form-urlencoded
body: <p>I know this question has been asked before but none of the answers suits my case. So i have to ask for help.
  I am new to JERSEY and I'm supposed to make a rest client that connects to a service and gets a token from it.
  The code is the following:</p>
  
  <pre><code> public String getToken() {
          String urlToken = "http://example.com";
          Client client = Client.create();
          Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
          params.put("username","username" );
          GenericEntity&lt;Map&lt;String, String&gt;&gt; entity = new GenericEntity&lt;Map&lt;String, String&gt;&gt;(params){};
          client.addFilter(new LoggingFilter());
          WebResource webResource = client.resource(UriBuilder.fromUri(urlToken).build());
          String response = webResource
                  .type("application/x-www-form-urlencoded")
                  .post(String.class,entity);
  
  
          return response;
      }
  </code></pre>
  
  <p>The error is the following:</p>
  
  <pre><code>HTTP Status 500 - com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.util.HashMap, and MIME media type, application/x-www-form-urlencoded, was not found
  
  
  com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.util.HashMap, and MIME media type, application/x-www-form-urlencoded, was not found
      com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
      com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)
      com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
      com.sun.jersey.api.client.filter.LoggingFilter.handle(LoggingFilter.java:217)
      com.sun.jersey.api.client.Client.handle(Client.java:652)
      com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
      com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
      com.sgss.nove.service.tableau.impl.TableauManager.getToken(TableauManager.java:27)
      com.sgss.nove.server.TableauServlet.doGet(TableauServlet.java:52)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      com.sgss.nove.UserSessionControlFilter.doFilter(UserSessionControlFilter.java:130)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
      com.sgss.nove.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:56)
      org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  </code></pre>