title: Jackson Jaxb Json with Apache CXf
body: <p>I am using Jackson Jaxb JSON in my REST project with Apache CXF</p>
  
  <p>JacksonJaxb version . 1.7.0
  Apache CXF 2.3.1</p>
  
  <p>I am using following code to return from my method.</p>
  
  <pre><code>    @GET
      @Consumes({ "application/json", "application/xml", "text/xml" })
      @Path("/job/autosuggest")
      @Override
      public Response getSuggestions(String searchField, Integer resPerPage, String typeCont)
      {   
          List&lt;String&gt; respo = new ArrayList&lt;String&gt;();
          respo.add("Atish");
          respo.add("Narlawar");
          respo.add("India");
  
          return Response.ok(respo).build();
  }
  </code></pre>
  
  <p>Now issue is coming when I compile and run the code on jetty, I get stuck with </p>
  
  <pre><code>DEBUG o.s.b.f.s.DefaultListableBeanFactory [] Finished creating instance of bean 'org.apache.cxf.phase.PhaseManager'
  org.codehaus.jackson.map.JsonMappingException: Incompatible types: declared root type ([simple type, class javax.ws.rs.core.Response]) vs java.util.ArrayList
  </code></pre>
  
  <p>This is not particular to array or wrapper, but any object If I pass rather than String in Response.ok(object) fails to parse.</p>
  
  <p>My configuration is </p>
  
  <pre><code>  &lt;util:map id="jsonNamespaceMap" map-class="java.util.Hashtable"&gt;
          &lt;entry key="http://services.institute.com" value=""/&gt;
          &lt;entry key="http://cxf.apache.org/bindings/xformat" value="cxf"/&gt;
      &lt;/util:map&gt;
  
      &lt;bean id="jsonInputFactory" class="org.codehaus.jettison.mapped.MappedXMLInputFactory"&gt;
          &lt;constructor-arg ref="jsonNamespaceMap"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jsonOutputFactory" class="org.codehaus.jettison.mapped.MappedXMLOutputFactory"&gt;
          &lt;constructor-arg ref="jsonNamespaceMap"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/&gt;
  
      &lt;jaxrs:server id="jobsearch" address="/"&gt;
          &lt;jaxrs:serviceBeans&gt;
              &lt;ref bean="jobSearchService" /&gt;
          &lt;/jaxrs:serviceBeans&gt;
          &lt;jaxrs:extensionMappings&gt;
              &lt;entry key="text" value="text/xml"/&gt;
              &lt;entry key="xml" value="application/xml"/&gt;
              &lt;entry key="json" value="application/json"/&gt;
          &lt;/jaxrs:extensionMappings&gt;
          &lt;jaxrs:languageMappings/&gt;
          &lt;jaxrs:properties&gt;
              &lt;entry key="javax.xml.stream.XMLInputFactory"&gt;
                  &lt;ref bean="jsonInputFactory"/&gt;
              &lt;/entry&gt;
              &lt;entry key="javax.xml.stream.XMLOutputFactory"&gt;
                  &lt;ref bean="jsonOutputFactory"/&gt;
              &lt;/entry&gt;
          &lt;/jaxrs:properties&gt;
          &lt;jaxrs:providers&gt;         
              &lt;ref bean="jsonProvider"/&gt;     
          &lt;/jaxrs:providers&gt; 
      &lt;/jaxrs:server&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>I am not sure how to proceed on this issue. I already lost 1/2 day to get some workaround. Any help will be appreciated. </p>
  
  <p>Thanks in advance !</p>