cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fried Hoeben (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CXF-2411) ClassCastException when initializing JAXB Databinding based on WSDL
Date Mon, 31 Aug 2009 10:18:32 GMT

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

Fried Hoeben updated CXF-2411:
------------------------------

    Attachment: cxf-jaxb.patch

I believe this patch addresses this issue...

> ClassCastException when initializing JAXB Databinding based on WSDL
> -------------------------------------------------------------------
>
>                 Key: CXF-2411
>                 URL: https://issues.apache.org/jira/browse/CXF-2411
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.2.3
>            Reporter: Fried Hoeben
>         Attachments: cxf-jaxb.patch
>
>
> I have a service interface that returns an object of a class with a (bounded) type parameter.
One of the properties of this class is an array of of objects of this type parameter's type.

> E.g. 
> public interface Service {
> Result<A> do();
> }
> public class Result<T extends B> {
> private T[] content;
> public T[] getContent() {
> return content;
> }
> public void setContent(T[] content) {
> this.content = content;
> }
> }
> public class B {}
> public class A extends B {}
> I get the following exception:
> java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:185)
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:170)
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:281)
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227)
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:150)
> 	at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:109)
> 	at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:130)
> 	at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
> 	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:322)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:346)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:442)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:195)
> 	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:163)
> 	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
> 	at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
> 	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
> 	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115)
>         ...
> I believe the problem is that the JAXBContextInitializer performs a cast without checking
whether the array's elements are a class or a type variable. In case of a type variable the
bound of the type variable should (of course) be used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message