Details
Description
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.
public class MappedListXmlAdapter<K, V> extends XmlAdapter<JaxbHashMapList<K, V>, MappedList<K, V>> {
but the declaration without generic works:
public class MappedListXmlAdapter extends XmlAdapter<JaxbHashMapList, MappedList> {
Same apply for more complex XmlAdapter. Following throws exception.
public class EnumWrapperAdapter<T extends Enum<T>> extends XmlAdapter<T, EnumWrapper<T>> {
After this update it is ok
public class EnumWrapperAdapter extends XmlAdapter<Enum, EnumWrapper> {
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)