gpt4 book ai didi

wsdl - 生成wsdl时出现Axis2错误

转载 作者:行者123 更新时间:2023-12-01 07:31:32 24 4
gpt4 key购买 nike

我正在尝试使用 JAX-WS 和 JAXB 注释开发新的网络服务。当我在 axis2 中部署 .jar 并打开浏览器以检索生成的 .wsdl 时,出现以下错误:

[ERROR] Error occurred generating WSDL file for Web service implementation class {foo.bar.myServiceImpl}
java.lang.NoClassDefFoundError: com/sun/xml/ws/api/server/Container
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:179)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394)
at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:154)
at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.api.server.Container
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more

挖掘源代码,我注意到 com.sun.xml.ws.api.server.Container 是 jaxws-rt 实现的一部分,它不是 Axis2 分发的一部分(无法在/库/文件夹)。为什么是这样?我在这里漏掉了一点吗?

最佳答案

我遇到了同样的问题。我需要将依赖项添加到 jaxws-maven-plugin。没有这些依赖项,它会抛出同样的错误

        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<configuration>
<wsdlDirectory>src/main/resources/wsdl/</wsdlDirectory>
<keep>true</keep>
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
<sei></sei>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.4</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-from-wsdl</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>

关于wsdl - 生成wsdl时出现Axis2错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11205881/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com