cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5220) Json API client does not work with Jackson 2.2
Date Wed, 21 Aug 2013 06:54:51 GMT

    [ https://issues.apache.org/jira/browse/CXF-5220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13745830#comment-13745830
] 

Sergey Beryozkin commented on CXF-5220:
---------------------------------------

Thanks for reporting this issue. It actually has been fixed in CXF 2.6.9 - the fix did not
make it into 2.5.11 due to rather sensitive changes.
Consider upgrading to CXF 2.6.9 or CXF 2.7.6. If you can't then a simple workaround is to
register a custom JSONProvider which will simply delegate to Jackson 2.2 provider
                
> 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}
> Note the last line. It should've used JacksonJsonProvider instead.

--
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

Mime
View raw message