Hi

I got a java client and server program off the internet and i'm trying to
run it...the server code seems to be fine - it's up and running, but when I
try to run the client program, I get the following error -

Exception in thread "main" java.lang.InstantiationError:
org.apache.xmlrpc.XmlRpcRequest
        at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:177)
        at JavaClient.main(JavaClient.java:16)

Here's my client code -

import java.util.*;
import org.apache.xmlrpc.*;

public class JavaClient 
{
        public static void main(String[] args) 
        {
                try 
                {
                        XmlRpcClient client = new 
XmlRpcClient("http://localhost:8901/";);
                        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 exception) 
                {
                        System.err.println("JavaClient: " + exception);
                }
        }
}


And here's my server code - 

import org.apache.xmlrpc.WebServer;

public class JavaServer 
{
        public Integer sum(int x, int y) 
        {
                return new Integer(x + y);
        }

        public static void main(String[] args) 
        {
                try 
                {
                        System.out.println("Attempting to start XML-RPC 
Server...");
                        WebServer server = new WebServer(8901);
                        server.setParanoid(true);
                        server.acceptClient("127.0.0.1");
                        server.addHandler("sample", new JavaServer());
                        server.start();
                        System.out.println("Started successfully.");
                        System.out.println("Accepting requests. (Halt program 
to stop.)");
                } 
                catch (Exception exception) 
                {
                        System.err.println("JavaServer: " + exception);
                }
        }
}

Does anybody know what could be the problem? Any help would be much
appreciated!
-- 
View this message in context: 
http://old.nabble.com/Error-using-xml-rpc-with-java-code-tp30583985p30583985.html
Sent from the Apache Xml-RPC - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to