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

1 に答える 1