繁体   English   中英

线程“main”中的异常java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton

[英]Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton

在这里我试图通过wsdl使用webservices进行调用,同时运行代码获取以下异常。 同时显示测试代码,请帮帮我。 谢谢。

 import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.commons.codec.binary.Base64;

import javax.xml.namespace.QName;
import java.net.URL;


public class WebTest {
    Service service = null;

    String endpoint = "http://mytest.com/test/Signup.jws";
    String userName =  "globel";
    String userPw =  new String(Base64.decodeBase64("Z23fG46732345FG=".getBytes()));;

    public WebTest() {
        try {
            service = new Service();
            System.out.println("*** executed successfully ");
        } catch (Exception e) {
            System.out.println("Exception - " + e.getMessage());
        }
    }
    public void testWeb(String f1, String f2, String f3, int itemcode, String f4){
    try {
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress(new URL(endpoint));
            call.setOperationName(new QName("emp"));
            call.setUsername(userName);
            call.setPassword(userPw);
            Object[] params = new Object[5];
            params[0] = new String(f1);
            params[1] = new String(f2);
            params[2] = new String(f3);
            params[3] = new Integer(itemcode);
            params[4] = new String(f4); 
            call.invoke(params);

        } catch (Exception e) {
             System.out.println("Exception - " + e.getMessage());
        }
    }

    public static void main(String[] args) {
        String orderDate = "03-Jan-2013";
        WebTest webtest= new WebTest() ;
        webtest.testWeb("rayban","aviator",orderDate,82724,"113000") ;
    }

}

得到以下错误 -

线程“main”中的异常java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton at java.security的org.apache.axis.components.logger.LogFactory $ 1.run(LogFactory.java:45)。 org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)上的orcon.apache.axis.components.logger.LogFactory。(LogFactory.java:33)中的AccessController.doPrivileged(本机方法) .apache.axis.handlers.BasicHandler。(BasicHandler.java:43)位于org.apache.axis.client.Service的org.apache.axis.client.Service.getAxisClient(Service.java:207)。(Service.java :225)

对于maven用户:将commons-discovery依赖项添加到pom.xml文件中,例如

<dependency>
    <groupId>commons-discovery</groupId>
    <artifactId>commons-discovery</artifactId>
    <version>0.4</version>
</dependency>

在我的代码中添加了discovery-0.4.jar,它解决了我的问题。

在我的情况下,我添加了commons-discovery-0.2.jar

添加pom.xml

<dependency>
        <groupId>commons-discovery</groupId>
        <artifactId>commons-discovery</artifactId>
        <version>0.5</version>
    </dependency>

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM