# Exception in axis2 java2wsdl ant Task



## scabies (30. Jul 2008)

ich habe beim Generieren der WSDL-Datei folgende CastException;


```
Deleting: C:\projects\yolbil\Axis2WSExample\wsdlFiles\MyService.wsdl
axis-java2wsdl
log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
log4j:WARN Please initialize the log4j system properly.
C:\projects\yolbil\Axis2WSExample\axisBuild.xml:96: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
	at org.apache.axis2.tool.ant.Java2WSDLTask.execute(Java2WSDLTask.java:270)
	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:585)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	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:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
	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:585)
	at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
	at org.apache.ws.java2wsdl.Java2WSDLBuilder.<init>(Java2WSDLBuilder.java:108)
	at org.apache.ws.java2wsdl.Java2WSDLCodegenEngine.<init>(Java2WSDLCodegenEngine.java:51)
	at org.apache.axis2.tool.ant.Java2WSDLTask.execute(Java2WSDLTask.java:267)
	... 22 more
Caused by: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
	at org.apache.axis2.deployment.DescriptionBuilder.loadMessageReceiver(DescriptionBuilder.java:192)
	at org.apache.axis2.deployment.DescriptionBuilder$1.run(DescriptionBuilder.java:145)
	at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132)
	at org.apache.axis2.deployment.DescriptionBuilder.processMessageReceivers(DescriptionBuilder.java:141)
	at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:102)
	at org.apache.axis2.context.ConfigurationContextFactory.createBasicConfigurationContext(ConfigurationContextFactory.java:317)
	at org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext(ConfigurationContextFactory.java:304)
	at org.apache.ws.java2wsdl.Java2WSDLBuilder.<init>(Java2WSDLBuilder.java:101)
	... 24 more
--- Nested Exception ---
java.lang.RuntimeException: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
	at org.apache.ws.java2wsdl.Java2WSDLBuilder.<init>(Java2WSDLBuilder.java:108)
	at org.apache.ws.java2wsdl.Java2WSDLCodegenEngine.<init>(Java2WSDLCodegenEngine.java:51)
	at org.apache.axis2.tool.ant.Java2WSDLTask.execute(Java2WSDLTask.java:267)
	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:585)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	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:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
	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:585)
	at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)
Caused by: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
	at org.apache.axis2.deployment.DescriptionBuilder.loadMessageReceiver(DescriptionBuilder.java:192)
	at org.apache.axis2.deployment.DescriptionBuilder$1.run(DescriptionBuilder.java:145)
	at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132)
	at org.apache.axis2.deployment.DescriptionBuilder.processMessageReceivers(DescriptionBuilder.java:141)
	at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:102)
	at org.apache.axis2.context.ConfigurationContextFactory.createBasicConfigurationContext(ConfigurationContextFactory.java:317)
	at org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext(ConfigurationContextFactory.java:304)
	at org.apache.ws.java2wsdl.Java2WSDLBuilder.<init>(Java2WSDLBuilder.java:101)
	... 24 more
```


Was ich machen sollte hat jemand eine Idee?

[/quote]


----------



## FArt (30. Jul 2008)

Sieht nach einem ClassLoader-Problem aus.

Anscheinend wird die Klasse org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver vom ANT ClassLoader geladen und noch von einem anderen (evtl. aus der IDE?)... 

Versuche mal das ANT Skript von der Kommandozeile aus aufzurufen.

Je nachdem wie das Skript aufgebaut ist, könnten die konkurrierenden ClassLoader auch aus dem ANT Buildlauf komme.



P.S.: gut Wahl der IDE ;-)


----------

