问题
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