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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39539431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:17:15  来源:igfitidea点击:

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

javaeclipseapachewsdlaxis2

提问by Neha

I am trying to make a simple webservice using WSDL using Axis 2 (1.7.3) and tomcat server (V6.0) while creating a webservice client I am getting this error, I have tried everything by changing the versions of server to add or delete some jar files but nothing seem to work.

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

I have added XMLSchema core - 2.2.1 jar file to lib folder and add it to project build path , also I add the XMLSchema file to the server config folder, but nothing to seem to work for this. I am using jdk version 1.8.0. with lower versions it still don't work and I am working Eclipse Neon. I don't know what I am missing.

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

Below is my WSDL which is being made at server end:

下面是我在服务器端制作的 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>

I have added the picture of the error:

我已经添加了错误的图片:

<This is the error, I am getting again and again>.

<这是错误,我一次又一次地出现>。

回答by Jens

You have to add the xmlscema-core.jarto your classpath. You can download it here

您必须将xmlscema-core.jar加到您的类路径中。你可以在这里下载

If you use maven, add the following dependency

如果使用maven,添加如下依赖

<!-- 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>

回答by Jerome Campbell

  1. Use AXIS 1.6.4 (instead of Latest 1.7.4)
  2. Tomcat 7
  3. Dynamic Web Project 2.5
  4. Set Axis 2 runtime location to 1.6.4 - Eclipse -> Preferences -> Web Services -> Axis 2 Preferences
  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

回答by Devendra

Add woden-core-1.0M10.jar in your lib folder.

在 lib 文件夹中添加 woden-core-1.0M10.jar。

Maven :

马文:

<dependency>
    <groupId>org.apache.woden</groupId>
    <artifactId>woden-core</artifactId>
    <version>1.0M10</version>
</dependency>

回答by amitmah

This is mostly due to missing dependencies. The NoClassDefError is when there are multiple versions of same class are loaded or classpath is not proper. There are many ways to solve this:

这主要是由于缺少依赖项。NoClassDefError 是当加载了同一类的多个版本或类路径不正确时。有很多方法可以解决这个问题:

  1. Add jars one by one till transitive dependencies are resolved.
  2. Keep all jars from AXIS web application lib directory as part of AXIS_LIB library and add it as dependency.
  3. Refer maven dependencies list and add those jars with correct version and correct java/javac compiler level and runtime. Reference: axis2 maven example
  4. Create a new project using eclipse or SoapUI tool and generate a webservice from tool. This will generate the dependencies and libraries for you.
  1. 一个一个地添加 jars,直到传递依赖解决。
  2. 保留 AXIS Web 应用程序库目录中的所有 jar 作为 AXIS_LIB 库的一部分,并将其添加为依赖项。
  3. 参考 Maven 依赖项列表并添加具有正确版本和正确 java/javac 编译器级别和运行时的那些 jar。参考:axis2 maven 示例
  4. 使用 eclipse 或 SoapUI 工具创建一个新项目并从工具生成一个 web 服务。这将为您生成依赖项和库。

Hope this helps.

希望这可以帮助。