title: CXF/JAXB fails at marshalling primitive long return value
body: <p>I have a simple <strong>CXF</strong> method that returns a <strong>long</strong></p>
  
  <pre><code>  @GET
    @Path("/count/{foo}/{bar}")
    long count(@PathParam("foo") String foo, @PathParam("bar") String bar)
  </code></pre>
  
  <p>I have a CXF server with JAXB setup for it </p>
  
  <pre><code>&lt;jaxrs:server id="myServer" address="/"&gt;
      &lt;jaxrs:providers&gt;
        &lt;bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"&gt;
          &lt;property name="singleJaxbContext" value="true" /&gt;
          &lt;property name="skipJaxbChecks" value="true" /&gt;
          &lt;property name="validateOutput" value="false" /&gt;
        &lt;/bean&gt;
      &lt;/jaxrs:providers&gt;
      &lt;jaxrs:serviceBeans&gt;
        &lt;ref bean="myServiceImpl" /&gt;
      &lt;/jaxrs:serviceBeans&gt;
  &lt;/jaxrs:server&gt;
  </code></pre>
  
  <p>But when I call this method, the server fails at marshalling the result :</p>
  
  <blockquote>
    <p>Caused by: com.sun.istack.SAXException2: unable to marshal type
    "java.lang.Long" as an element because it is missing an
    @XmlRootElement annotation</p>
  </blockquote>
  
  <p>How come CXF is not able to marshal a <strong>long</strong> ?
  Thanks for your help</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am actually writing a mockup implementation of an existing service (for test purposes).
  I have no control on the API of the existing service.
  And its current implementation returns something like</p>
  
  <pre><code>Response-Code: 200
  Encoding: ISO-8859-1
  Content-Type: application/xml
  Headers: {connection=[close], Content-Length=[3], content-type=[application/xml], Date=[Wed, 23 Jul 2014 08:00:31 GMT]}
  Payload: 121
  </code></pre>
  
  <p>Which is no real XML i agree.
  But the current client does not complain either, and does no contain any magic for it.</p>