title: Type boolean, and MIME media type application/octet-stream was not found Java (Jersey)
body: <p>I am using Jersey version 1.12 and i am facing the error that is</p>
  
  <pre><code>A message body writer for Java class java.lang.Boolean, and Java type boolean, and MIME media type application/octet-stream was not found
  
      at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>my code is </p>
  
  <pre><code>        @POST
          @Path("/save/{Name}/{data}")
          @Consumes("application/x-www-form-urlencoded")
          public String saveDataMap(@QueryParam("number") String number,
          @PathParam("data") String data,
          @PathParam("Name") String appName
          MultivaluedMap&lt;String, String&gt; formParam) throws Exception{
          boolean response =false'
          try{
          // some business logic
          response =true
          }
  
          return response;
          }
  </code></pre>
  
  <p>After Googling this error i found that this is due to you are not specifying the content type of the data you are sending - so Jersey is not able to locate the right MessageBodyWritter to serialize</p>
  
  <p>after this i added produces anotation to the method with the <code>MediaType.TEXT_PLAIN</code> but it doesn't work ,but when i changed return type of method to <code>String</code> it started working.</p>
  
  <p>I simply wants to know whats problem with boolean ,why it is not working with boolean ? and how to solve this problem without changing boolean to String ?</p>
  
  <p>any help will be greatly appreciated.</p>