简体   繁体   English

Axis2 Soap WS客户端:java.lang.NoClassDefFoundError:org / apache / ws / commons / schema / XmlSchema

[英]Axis2 Soap WS client: java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema

I had an issue today while generating a SOAP Web Service client using Apache Axis 2 1.7.4 and Eclipse Neon 4.6.3RC3. 我今天在使用Apache Axis 2 1.7.4和Eclipse Neon 4.6.3RC3生成SOAP Web服务客户端时遇到问题。

The way I was generating the Web Service client was: 我生成Web Service客户端的方式是:

  1. Right click on my WSDL > "Web Services" > "Generate client" 右键单击我的WSDL>“ Web服务”>“生成客户端”
  2. Select "Apache Axis2" as Web Service Runtime and "Tomcat 7" as Server Runtime (all the other options are defaults) 选择“ Apache Axis2”作为Web服务运行时,选择“ Tomcat 7”作为服务器运行时(所有其他选项均为默认设置)
  3. Click on "Finish" 点击“完成”

The error I got was: 我得到的错误是:

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

错误

Although there are plenty of answers on StackOverflow about this issue, none really solved this for me, so I thought that I would share what did fixed my problem (along with a summary of other proposed solutions) hoping that in the future this post will help somebody. 尽管在StackOverflow上有很多关于此问题的答案,但没有一个能真正为我解决这个问题,因此我认为我将分享解决我的问题的方法(以及其他建议的解决方案的摘要),希望以后这篇文章对您有所帮助有人。

If anybody wants to add his knowledge to this post, go ahead and leave a comment/answer. 如果有人想在此帖子中添加自己的知识,请继续发表评论/答案。

1. Add missing XML schema dependency 1.添加缺少的XML模式依赖项

In many cases, this seems related to a missing dependency on the project. 在许多情况下,这似乎与对项目的依赖缺失有关。 The missing dependency seems to be xmlschema-core-2.2.1.jar . 缺少的依赖项似乎是xmlschema-core-2.2.1.jar You can add it on a Maven project like this: 您可以将其添加到Maven项目中,如下所示:

<dependency>
    <groupId>org.apache.ws.xmlschema</groupId>
    <artifactId>xmlschema-core</artifactId>
    <version>2.2.1</version>
</dependency>

Source: https://stackoverflow.com/a/36497872/4921205 资料来源: https : //stackoverflow.com/a/36497872/4921205

If you are not using Maven, you can download the libraries and add them manually to your classpath. 如果您不使用Maven,则可以下载库并将它们手动添加到类路径中。

Important Note: for some reasons, it seems that even if you add the new libraries, you will need to restart your Eclipse before the new libraries are picked up. 重要说明:由于某些原因,即使您添加了新库,您似乎也需要在选择新库之前重新启动Eclipse。

2. Use Axis2 1.6.x 2.使用Axis2 1.6.x

Since this seems a bug introduced in Axis2 1.7.x , another possible solution may be to use 1.6.x jar if possible. 由于这似乎是Axis2 1.7.x引入的错误, Axis2 1.7.x ,另一个可能的解决方案是,如果可能的话,使用1.6.x jar。

3. Revert the Dynamic Web Module project facet to version 2.3 3.将Dynamic Web Module项目切面恢复为2.3版

This was what actually did the trick for me. 这实际上是对我有用的窍门。 The project was using the Dynamic Web Module 2.5 facet and that doesn't seem to work properly with this Axis version (I was aware that 3.0 had problems). 该项目使用的是Dynamic Web Module 2.5构面,并且似乎不适用于此Axis版本(我知道3.0出现了问题)。 After switching to 2.3 generating only a developement client worked. 切换到2.3后,仅生成开发客户端。 Here's how to do it: 方法如下:

  1. Right click on the project -> "Properties" -> "Project Facets" 右键单击项目->“属性”->“项目构面”
  2. Select version of "Dynamic Web Module" and set it to 2.3 from the right dropdown (if this window is empty you may have to convert the project in faceted form by clicking on the link provided in the same window). 选择“动态Web模块”的版本,然后从右侧下拉列表中将其设置为2.3(如果此窗口为空,则可能必须通过单击同一窗口中提供的链接以多面体形式转换项目)。
  3. Right click on your WSDL -> "Web Services" -> "Generate client" 右键单击您的WSDL->“ Web服务”->“生成客户端”

在此处输入图片说明

  1. Set the Develop client only option by dragging down the meter on the left, set your server runtime and choose Axis2 as your Web service runtime. 通过向下拖动左侧的仪表来设置“仅开发客户端”选项,设置服务器运行时,然后选择Axis2作为Web服务运行时。

    在此处输入图片说明

  2. Click on "Finish" and you should see your Web Service client generated under the src folder. 单击“完成”,您应该看到src文件夹src Web Service客户端。

从$ AXIS2_HOME / lib手动将xmlschema-core-2.2.1.jar复制到Eclipse项目目录WebContent / WEB-INF / lib ,在生成Web服务客户端之前关闭并重新打开eclipse。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Axis2 错误 - java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema - Axis2 Error - java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema Eclipse Web 服务 NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema? - Eclipse web service NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema? java.lang.NoClassDefFoundError:org / apache / axis2 / client / Stub - java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub java.lang.ClassNotFoundException:org.apache.ws.commons.schema.XmlSchema - java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchema 线程“主”中的异常 java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer eXist xml db:java.lang.NoClassDefFoundError:org / apache / ws / commons / serialize / DOMSerializer - eXist xml db : java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer NoClassDefFoundError: org/apache/commons/httpclient/HttpException 在使用 Axis2 进行 WS 调用时 - NoClassDefFoundError: org/apache/commons/httpclient/HttpException while making WS call with Axis2 java.lang.NoClassDefFoundError:Ljavax / ws / rs / client / Client - java.lang.NoClassDefFoundError: Ljavax/ws/rs/client/Client 引起:java.lang.NoClassDefFoundError:org / apache / cxf / ws / policy / builder / jaxb / JaxbAssertionBuilder - Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder java.lang.NoClassDefFoundError:org / apache / commons / lang / text / StrLookup - java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrLookup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM