Hi Florin,
You should try to catch the ClassNotFoundException that may be thrown be
your Class.forName() call e.g:
catch(ClassNotFoundException e)
{
System.err.println("ClassNotFoundException occured " + e);
e.printStackTrace();
}
catch (XMLDBException e) {
System.err.println("XML:DB Exception occured " + e.errorCode + " "
+
e.getMessage());
}
catch(Exception e)
{
System.err.println("Exception occured " + e);
e.printStackTrace();
}
I have also added an extra catch to catch all other types of Exception that
may occur.
See if you get any Exception info/trace. That should indicate the problem
you're having. My guess is that you don't have the driver class
(org.apache.xindice.client.xmldb.DatabaseImpl) on your webapp's classpath.
Check that you have xindice.jar in the WEB-INF/lib directory of your
web-app.
-- Peter
-----Original Message-----
From: Florin Tudor [mailto:[EMAIL PROTECTED]
Sent: 24 May 2002 16:17
To: [email protected]
Subject: XMLDB in servlets
I have a BIG problem:
When I compile and run Example1.java that comes in the Developer's Guide,
it's OK. (a basic query with the XMLDB API).
Now I want to do the same thing from a servlet, because this is the way I
want to use it.
BUT... the same code doesn't even compile !!!
Compile error:
XMLDBQuery.java:40: registerDatabase(org.xmldb.api.base.Database) in
org.xmldb.api.DatabaseManager cannot be applied to (Database)
DatabaseManager.registerDatabase(db);
I checked the API but all seems OK, tried with JDK1.3 and 1.4, with
different versions of servlet.jar, doesn't help.
I have a servlet that does the same thing using XML-RPC and it works.
Attached is the damn servlet.
Florin Tudor
Web Application Developer / Consultant
Middleware & Programming Dept.
Integrator /SAP Romania
www.sap.ro, www.integrare.ro