cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4708) Unnable to publish service when XmlAdapter has generic parameter
Date Wed, 19 Dec 2012 15:23:12 GMT

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

Daniel Kulp commented on CXF-4708:
----------------------------------


I need a more complete test case as I cannot reproduce this.   I tried a simple structure
like:

{code}
    enum TestEnum {
        VAL1, VAL2
    };
    
    public static class EnumWrapper<T> {
        String wraperValue;
        public EnumWrapper() {
        }
        public EnumWrapper(TestEnum e) {
            wraperValue = e.toString();
        }
        public String getWraperValue() {
            return wraperValue;
        }
        public void setWraperValue(String wraperValue) {
            this.wraperValue = wraperValue;
        }
    }
    public static class EnumWrapperAdapter<T extends Enum<T>> extends XmlAdapter<T,
EnumWrapper<T>> {

        public EnumWrapper<T> unmarshal(T v) throws Exception {
            // TODO Auto-generated method stub
            return null;
        }

        public T marshal(EnumWrapper<T> v) throws Exception {
            // TODO Auto-generated method stub
            return null;
        }
    }

    public static class ConcreteEnumWrapperAdapter extends EnumWrapperAdapter<TestEnum>
{

        
    }
    
    @WebService
    public static class GenericAdapterService {
        
        @WebMethod
        @XmlJavaTypeAdapter(value = ConcreteEnumWrapperAdapter.class)
        public EnumWrapper<TestEnum> create(String t) {
            return new EnumWrapper<TestEnum>(TestEnum.VAL1);
        }
    }
{code}

but that is working fine.   I definitely need more information.

                
> Unnable to publish service when XmlAdapter has generic parameter
> ----------------------------------------------------------------
>
>                 Key: CXF-4708
>                 URL: https://issues.apache.org/jira/browse/CXF-4708
>             Project: CXF
>          Issue Type: Bug
>          Components: Core, Tooling
>    Affects Versions: 2.7.1
>         Environment: Maven 3.0.4, cxf-java2ws-plugin 2.7.1
>            Reporter: Jakub Štiller
>            Priority: Critical
>             Fix For: NeedMoreInfo
>
>
> Following exception is thrown when generate WSDL from Java Code. I was able to debug
the code and found that problem is that implementation of the XmlAdapter contains generic
typed class.
> Eg. Following XmlAdapter declaration does not work.
> {code}
> public class MappedListXmlAdapter<K, V> extends XmlAdapter<JaxbHashMapList<K,
V>, MappedList<K, V>> {
> {code}
> but the declaration without generic works:
> {code}
> public class MappedListXmlAdapter extends XmlAdapter<JaxbHashMapList, MappedList>
{
> {code}
> Same apply for more complex XmlAdapter. Following throws exception.
> {code}
> public class EnumWrapperAdapter<T extends Enum<T>> extends XmlAdapter<T,
EnumWrapper<T>> {
> {code}
> After this update it is ok
> {code}
> public class EnumWrapperAdapter extends XmlAdapter<Enum, EnumWrapper> {
> {code}
> *This is regression as it works with plugin version 2.5.2*
> java.lang.RuntimeException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
cannot be cast to java.lang.Class
>         at org.apache.cxf.frontend.AbstractServiceFactory.createService(AbstractServiceFactory.java:80)
>         at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:101)
>         at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110)
>         at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
>         at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
>         at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
>         at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
>         at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
>         at org.apache.cxf.maven_plugin.Java2WSMojo.processJavaClass(Java2WSMojo.java:357)
>         at org.apache.cxf.maven_plugin.Java2WSMojo.execute(Java2WSMojo.java:225)
>         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>         at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
cannot be cast to java.lang.Class
>         at org.apache.cxf.jaxb.Utils.getTypeFromXmlAdapter(Utils.java:294)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:295)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:222)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:212)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:225)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:212)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:337)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:309)
>         at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:173)
>         at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:109)
>         at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
>         at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:318)
>         at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:474)
>         at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:536)
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:248)
>         at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
>         at org.apache.cxf.frontend.AbstractServiceFactory.createService(AbstractServiceFactory.java:78)

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