简体   繁体   中英

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer

Hello everyone so i want to use xmlRpc in my simple project i have downloaded org-apache-xmlrpc.jar

this is part of my code

import java.util.*;

import org.apache.xmlrpc.webserver.WebServer;
import org.apache.xmlrpc.server.*;
public class Serveur{
    
    private static Vector<String> user = new Vector<String>();
    String msg_courant = null;
    
    public static void main (String [] args){
    try { 
            System.out.println("Attempting to start XML-RPC Server...");
            
            WebServer server = new WebServer(9980);
            PropertyHandlerMapping handlerMapping = new PropertyHandlerMapping();
            handlerMapping.addHandler("sample", Serveur.class);
            XmlRpcServer xmlRpcServer = server.getXmlRpcServer();
            xmlRpcServer.setHandlerMapping(handlerMapping);

            XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
            serverConfig.setEnabledForExtensions(true);
            serverConfig.setContentLengthOptional(false);

            server.start();
    }
    catch (Exception exception){ System.err.println("JavaServer: " + exception); }
    }

    public boolean subscribe(String pseudo) {
    ...
    }
    
    public String postMessage(String pseudo, String message) {
       ...
    }
    
    public String getMessage(){
        ...
    }
    
    public boolean unsubscribe(String pseudo) {
        ...
    }
}

this is how i run my program and it work without any problemjavac示例 but when i try to execute the programjava示例

i have this error

厄尔

That is the content of the lib folder of the package I downloaded ( apache-xmlrpc-3.1.2-bin ) from here :

在此处输入图像描述

DOMSerializer is part of the second JAR file that is probably missing on your classpath.

Note: javac is not for running the program, it just compiles the source code.

You've been missing ws-commons-util.jar . You can download it from the web. Try here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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