Axis2错误 - java.lang.NoClassDefFoundError:org / apache / ws / commons / schema / XmlSchema

问题描述 投票:4回答:3

我正在尝试使用WSDL使用Axis 2(1.7.3)和tomcat服务器(V6.0)创建一个简单的Web服务,同时创建一个Web服务客户端我收到此错误,我已尝试通过更改要添加的服务器版本或删除一些jar文件,但似乎没有任何工作。

我已将XMLSchema core - 2.2.1 jar文件添加到lib文件夹并将其添加到项目构建路径,我还将XMLSchema文件添加到服务器配置文件夹,但似乎没有任何工作。我使用的是jdk 1.8.0版。较低版本它仍然无法工作,我正在使用Eclipse Neon。我不知道我错过了什么。

下面是我在服务器端制作的WSDL:

<?xml version="1.0" encoding="UTF-8"?>

  <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

  <wsdl:port binding="impl:OperatorClassSoapBinding" name="OperatorClass">

     <wsdlsoap:address location="http://localhost:8080/Testwebservice/services/OperatorClass"/>

  </wsdl:port>

我添加了错误的图片:

<Qazxswpoi>。

java eclipse apache wsdl axis2
3个回答
1
投票
  1. 使用AXIS 1.6.4(而不是最新的1.7.4)
  2. 雄猫7
  3. 动态Web项目2.5
  4. 将Axis 2运行时位置设置为1.6.4 - Eclipse - > Preferences - > Web Services - > Axis 2 Preferences

0
投票

您必须将This is the error, I am getting again and again添加到类路径中。你可以下载它xmlscema-core.jar

如果使用maven,请添加以下依赖项

here

0
投票

这主要是由于缺少依赖性。 NoClassDefError是在加载相同类的多个版本或类路径不正确的情况下。有很多方法可以解决这个问题:

  1. 逐个添加罐子直到解决传递依赖性。
  2. 保留AXIS Web应用程序li​​b目录中的所有jar作为AXIS_LIB库的一部分,并将其添加为依赖项。
  3. 请参阅maven依赖项列表并添加具有正确版本和正确java / javac编译器级别和运行时的jar。参考:<!-- https://mvnrepository.com/artifact/org.apache.ws.commons.schema/XmlSchema --> <dependency> <groupId>org.apache.ws.commons.schema</groupId> <artifactId>XmlSchema</artifactId> <version>1.4.7</version> </dependency>
  4. 使用eclipse或SoapUI工具创建一个新项目,并从工具生成Web服务。这将为您生成依赖项和库。

希望这可以帮助。

© www.soinside.com 2019 - 2024. All rights reserved.