Results 1 to 2 of 2
  1. #1
    mith86 is offline Member
    Join Date
    Jan 2011
    Rep Power

    Exclamation Error using xml-rpc with java code


    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(XmlRpcClien
    at JavaClient.main(

    Here's my client code -

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

    public class JavaClient
    public static void main(String[] args)
    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)
    System.out.println("Attempting to start XML-RPC Server...");
    WebServer server = new WebServer(8901);
    server.addHandler("sample", new JavaServer());
    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!

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Pune, India
    Rep Power


    Here is what Javadoc says about java.lang.InstantiationError :-

    Thrown when an application tries to use the Java new construct to instantiate an abstract class or an interface.

    Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

    I hope you can figure out what needs to be done now.

    Hope that helps,

    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. error in code
    By Akap in forum New To Java
    Replies: 4
    Last Post: 01-31-2011, 07:37 AM
  2. Java code giving error
    By alfarida in forum New To Java
    Replies: 3
    Last Post: 11-10-2010, 08:11 PM
  3. Java code error!~ Please help
    By socboy6579 in forum New To Java
    Replies: 1
    Last Post: 10-15-2010, 04:47 AM
  4. Error Code???
    By andmartha in forum New To Java
    Replies: 11
    Last Post: 10-04-2008, 03:16 AM
  5. Replies: 16
    Last Post: 08-05-2008, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts