Web Services 加载消息接收方org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver时出现ClassNotFoundException错误

vmdwslir  于 2022-11-15  发布在  Apache
关注(0)|答案(1)|浏览(217)

我正在尝试运行一个基于SOAP Web服务的应用程序,但我不太确定这个错误是什么。下面是我的主要方法:

public static void main(String[] args){
try {
    URL wsdlURL = new URL("http://localhost:8081/JAXWS-Tomcat/userWS?wsdl");
    QName qname = new QName("http://service.jaxws.journaldev.com/", "UserServiceImpl");
    Service service = Service.create(wsdlURL, qname);
    UserService us = service.getPort(UserService.class);

    MyPackage myPackage =  new MyPackage();


} catch (MalformedURLException e) {
    e.printStackTrace();
}
}

完整的错误描述:

Exception in thread "main" javax.xml.ws.WebServiceException: Error getting Client Configuration Context : A ClassNotFoundException error occurred in loading the message receiver org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118)
at org.apache.axis2.jaxws.ClientConfigurationFactory.getClientConfigurationContext(ClientConfigurationFactory.java:119)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:93)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:79)
at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:78)
at org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:218)
at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:83)
at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:79)
at javax.xml.ws.Service.<init>(Service.java:36)
at javax.xml.ws.Service.create(Service.java:116)
at start.SOAPClient.main(SOAPClient.java:17)

调用Service.create()方法时引发异常。
下面是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ds</groupId>
    <artifactId>ass4</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <dependencies>

        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.2.10</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.3.0</version>
        </dependency>

        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>javax.activation-api</artifactId>
            <version>1.2.0</version>
        </dependency>

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

        <!--&lt;!&ndash; https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api &ndash;&gt;-->
        <!--<dependency>-->
            <!--<groupId>javax.xml.ws</groupId>-->
            <!--<artifactId>jaxws-api</artifactId>-->
            <!--<version>2.3.1</version>-->
        <!--</dependency>-->

    </dependencies>

    <distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>corp1</id>
            <name>Corporate Repository</name>
            <url>scp://repo/maven2</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>

</project>

我已经尝试了所有我能想到的,考虑到我是新的在这个SOAP网络服务领域,所以我真的需要一些帮助。谢谢!

ilmyapht

ilmyapht1#

我通过在pom.xml中添加正确的依赖项来解决这个问题:

<!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb -->
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.8.0</version>
    </dependency>

相关问题