加载消息接收器org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver时发生ClassNotFoundException错误

时间:2018-12-12 21:51:01

标签: java web-services soap

我正在尝试运行基于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 Web服务领域的新手,我已经尽力了想,所以我真的可以使用一些帮助。 谢谢!

0 个答案:

没有答案