我必须使用XML-RPC上载图片以在JAVA中融合。

JAVA代码

import java.util.Vector;
import java.util.Hashtable;
import helma.xmlrpc.*;
import java.util.Arrays;

public class test {

    // The location of our server.
    private final static String server_url =
        "http://confluence.xyz.com:8080/rpc/xmlrpc";

    public static void main (String [] args) {
        try {

            // Create an object to represent our server.
            XmlRpcClient server = new XmlRpcClient(server_url);

            Vector<Object> params = new Vector<Object>();
            params.add("username");
            params.add("pass");

            String token = (String) server.execute("confluence2.login", params );
            System.out.println(token);
        }
         catch (Exception exception) {
            System.err.println("JavaClient: " + exception.toString());
        }
    }
}


我遇到错误

JavaClient: java.io.IOException: SAX driver not found: org.apache.xerces.parsers.S

最佳答案

您需要为此添加其他xercesImpl-2.2.1.jar。如果您使用的是maven,则只需添加xercesImpl maven dependency,如下所示:

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.2.1</version>
</dependency>


希望能帮助到你!

10-02 01:16