在 intellij 中生成 WSDL 时出错:ClassNotFoundException:org.apache.woden.WSDLException

Error generating WSDL in intellij : ClassNotFoundException: org.apache.woden.WSDLException

我连续 2 天遇到问题,我不知道如何解决,我在 IntelliJ 下有一个 axis 2 项目,我想为客户端生成 wsdl,但是当我尝试使用工具->Web 服务->从 WSDL 生成 Java 代码 ..

Generate Java code from wsdl...

我有以下错误:

  Retrieving document at 'http://localhost:8080/Axis2_Server_war_exploded/services/HelloWorld?wsdl'.
 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/woden/WSDLException
    at org.apache.axis2.description.WSDLToAxisServiceBuilder.<init>(WSDLToAxisServiceBuilder.java:103)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.<init> (WSDL11ToAxisServiceBuilder.java:225)
    at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.<init> (WSDL11ToAllAxisServicesBuilder.java:63)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:167)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:50)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
 Caused by: java.lang.ClassNotFoundException: org.apache.woden.WSDLException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 6 more
 Done

我在服务器端的服务如下:

services.xml :

<serviceGroup>
<service name="HelloWorld">
    <parameter name="ServiceClass">HelloWorld.HelloWorld</parameter>
    <operation name="sayHelloWorldFrom">
        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </operation>
</service>
</serviceGroup>

HelloWorld.java :

@WebService
 public class HelloWorld {
    @WebMethod
    public String sayHelloWorldFrom(String from) {
        String result = "Hello, world, from " + from;
        System.out.println(result);
        return result;
    }
 }

客户端maven依赖:

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

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.7.9</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-local</artifactId>
        <version>1.7.9</version>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.7.9</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2 -->
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.7.9</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>1.7.9</version>
    </dependency>

</dependencies>

感谢您的帮助!

我通过转到 文件->设置->工具->Web 服务 并设置正确的 axis2 二进制分发 解决了这个问题:

http://www.apache.org/dyn/closer.lua/axis/axis2/java/core/1.7.9/axis2-1.7.9-bin.zip

(我有一个 IntelliJ IDEA)。