XML-RPC to connect confluence in JAVA

你说的曾经没有我的故事 提交于 2019-12-12 04:14:44

问题


I have to use XML-RPC to upload a picture to confluence in JAVA.

JAVA CODE

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());
        }
    }
}

I am getting error

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

回答1:


You need to put additional xercesImpl-2.2.1.jar for this. If you were using maven ,you can just simply add xercesImpl maven dependency as below:

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

Hope it helps!



来源:https://stackoverflow.com/questions/22558235/xml-rpc-to-connect-confluence-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!