使用AXIS2运行Web服务时,tomcat服务器日志中的java.lang.ClassCastException

时间:2011-08-12 13:11:09

标签: java web-services soap axis2 classcastexception

我已经编写了一个web服务,它在UI上运行得非常好,并且所有单元测试都在通过。  我能够从Webservice发送请求和响应。

但是当我检查服务器日志时,我会看到这种堆栈跟踪。  有没有人早先见过这个例外?

我正在使用AXIS2,Java 6和tomcat 6。

java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver cannot be cast to org.apache.axis2.engine.MessageReceiver
    at org.apache.axis2.deployment.DescriptionBuilder.loadMessageReceiver(DescriptionBuilder.java:192)
    at org.apache.axis2.deployment.DescriptionBuilder$1.run(DescriptionBuilder.java:145)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:139)
    at org.apache.axis2.deployment.DescriptionBuilder.processMessageReceivers(DescriptionBuilder.java:141)
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:102)
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641)
    at org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:157)
    at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
    at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
    at org.apache.axis2.transport.http.AxisAdminServlet.init(AxisAdminServlet.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

1 个答案:

答案 0 :(得分:1)

当从不同的类加载器加载类时会发生这种情况。

确保类路径上只有一个axis2 JAR,并且您的应用无法从同一服务器上的其他应用中看到Axis2 JAR。