Search code examples
javasax

SAX driver can not be found


Trying to write simple client server app. The problem is SAX drivers can not be found. I am new to Java, so dont know how to solve this problem.

import helma.xmlrpc.WebServer;
import helma.xmlrpc.XmlRpc;

public class JavaServer {

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

    public static void main (String [] args){
        try {
            XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");

        } catch (ClassNotFoundException e) {
            System.out.println("Could not locate SAX Driver");
        }

        try {

            System.out.println("Attempting to start XML-RPC Server...");

            WebServer server = new WebServer(8080);
            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);
        }


    }
}

Solution

    1. Click here and download the xerces-2_6_2.jar, this is used to pars XML files

    2. In your Java project import it into your project's local libraries

    3. It supposed that now you have the access to org.apache.xerces.* classes.