Exception in thread "Thread-4" java.lang.InstantiationError: org.apache.xmlrpc.XmlRpcRequest
at org.apache.xmlrpc.XmlRpcRequestProcessor.decodeRequest(XmlRpcRequestProcessor.java:82)
at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:143)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:125)
at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:761)
at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:642)
at java.lang.Thread.run(Unknown Source)
这是我在 XML-RPC 中的 localhost 上运行客户端代码时遇到的错误。我用JAVA制作了服务器和客户端。我的服务器进程似乎运行正常。它正在成功等待客户端请求。
以下是我的客户代码。
package rpcpkg;
import java.net.URL;
import java.util.Vector;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class SimpleXmlrpc {
public SimpleXmlrpc() {
}
public static void main(String[] args) {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try{
config.setServerURL(new URL("http://localhost:8089/workspace3/JAVARPC/RPCSRC/rpcserverpkg/"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Vector params = new Vector();
params.addElement(new Integer(17));
params.addElement(new Integer(13));
Object result = client.execute("sample.sum", params);
int sum = ((Integer) result).intValue();
System.out.println("The sum is: "+ sum);
}
catch(Exception e)
{
System.out.println("Exception: " + e.getMessage());
}
}
}