cxf-issues mailing list archives

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

     [ https://issues.apache.org/jira/browse/CXF-5220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

bc Wong updated CXF-5220:
-------------------------

    Description: 
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.

  was:
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}

    
> 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