bc Wong created CXF-5220:
----------------------------

             Summary: Json API client does not work with Jackson 2.2
                 Key: CXF-5220
                 URL: https://issues.apache.org/jira/browse/CXF-5220
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.5.11
            Reporter: bc Wong


JacksonJsonProvider in Jackson 2.2 changes the signature to:
{noformat}
 JacksonJsonProvider extends ProviderBase<JacksonJsonProvider, ObjectMapper, 
JsonEndpointConfig, JsonMapperConfigurator>
{noformat}

That means it'll never get picked as a candidate for a message reader, because 
{{ProviderFactory#handleMapper}} has this:
{noformat}
Class<?> mapperClass =  ClassHelper.getRealClass(em.getProvider());
Type[] types = getGenericInterfaces(mapperClass);
for (Type t : types) {
    if (t instanceof ParameterizedType) {
        ParameterizedType pt = (ParameterizedType)t;
        Type[] args = pt.getActualTypeArguments();
        for (int i = 0; i < args.length; i++) {
            Type arg = args[i];
            if (arg instanceof TypeVariable) {         // <------ Always fail
                TypeVariable var = (TypeVariable)arg;
                Type[] bounds = var.getBounds();
{noformat}

And the symptom is that my API client (which has a dependency on Jackson 2.2.2) 
errors out like this:
{noformat}
Caused by: javax.ws.rs.WebApplicationException: 
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"items"). 
Expected elements are 
<{}cluster>,<{}clusterList>,<{}clusterRef>,<{}config>,<{}configList>,<{}healthCheck>,<{}parcel>,<{}role>,<{}roleConfigGroup>,<{}roleConfigGroupRef>,<{}roleTypeConfig>,<{}service>,<{}serviceConfig>,<{}serviceRef>
        at 
org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.handleExceptionEnd(AbstractJAXBProvider.java:602)
        at 
org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.handleJAXBException(AbstractJAXBProvider.java:614)
        at 
org.apache.cxf.jaxrs.provider.JSONProvider.readFrom(JSONProvider.java:248)
{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to