Well, at least unexpected for me..
I'm trying to make a connection to my xindice istance and the following
code throws an exception.

public int checkLogin(String username, String pwd) throws Exception {
   Collection col = null;
   int result = 0;
   try {
     //the following two lines cause the problem:
     String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
     Class c = Class.forName(driver);
     /*
     Database database = (Database) c.newInstance();
     DatabaseManager.registerDatabase(database);

     col =
        DatabaseManager.getCollection("xmldb:xindice:///db/REAP/UserProfiles");

    //defining a query and executing it
    String xpath = "//profile[username='"+username+"' and pwd='"+pwd+"']";
    XPathQueryService service =
       (XPathQueryService) col.getService("XPathQueryService","1.0");
    ResourceSet resultSet = service.query(xpath);

    //evaluating and returning result. If resultset contains
    //one hit, the username and password were correct
    int size = (int) resultSet.getSize();
    switch (size){
        case 0: result = 0; break; //user not found
        case 1: result = 1; break; //user found
        default : result = 2; //some undefined error.
    }
  }
  catch (Exception e) {
     //throws the exception back to the servlet to be handled there
     throw e;
  }
}

As you see I have isolated the problem to these lines:
     String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
     Class c = Class.forName(driver);
Evaluating the exception with e.getMessage() in  the calling
servlet returns
        "org.apache.xindice.client.xmldb.DatabaseImpl"
I have checked that the xindice.jar is in the classpath
Any help or hints are welcome

Yours �yvind

�yvind Vestavik
�vre M�llenberggt 44b
7014 Trondheim
[EMAIL PROTECTED]
41422911

Reply via email to