wsimport fails with ClassCastException when using xendorsed (Doc ID 1383447.1)

Last updated on JUNE 09, 2016

Applies to:

Oracle Weblogic Server - Version 11.1.1.1.0 to 11.1.1.6.0 [Release 11g]
Information in this document applies to any platform.

Symptoms

When using weblogic.jar in the classpath and building web service client using wsimport following exception are seen.


<path id="wsimport.classpath">
<pathelement location="<WEBLOGIC_HOME>\server\lib\weblogic.jar"/>
</path>

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="wsimport.classpath"/>
</taskdef>

<target name="generate-from-wsimport">
<wsimport
destdir="output"
debug="true"
verbose="true"
wsdl="TestService.wsdl"
xendorsed="true"/>




Running above ant task throws following errors.


BUILD FAILED
com.sun.xml.ws.util.ServiceConfigurationError: com.sun.tools.ws.processor.generator.Generator: Provider weblogic.wsee.jaxws.tools.processor.generator.AsyncHandlerGenerator is specified in jar:file:/C:/Oracle/Middleware/wls1035/wlserver_10.3/server/lib/weblogic.jar!/META-INF/services/com.sun.tools.ws.processor.generator.Generatorbut could not be instantiated: java.lang.ClassCastException
at com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:233)
at com.sun.xml.ws.util.ServiceFinder.access$300(ServiceFinder.java:141)
at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:379)
at com.sun.tools.ws.wscompile.WsimportTool.generateCode(WsimportTool.java:286)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:207)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:188)
at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:738)
at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:55)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990)
at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:374)
... 22 more

Total time: 1 second

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms