You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2009/09/03 23:02:57 UTC

[jira] Resolved: (CXF-2411) ClassCastException when initializing JAXB Databinding based on WSDL

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

Daniel Kulp resolved CXF-2411.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.4
         Assignee: Daniel Kulp


Definitely more work was needed to get it working in all cases (asm or no asm, wsdl or no wsdl), but I think it's OK now.



> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.2.4
>
>         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.