Thank you very much for the help. Can you please help me on the following. How do I make my program find the "driver" class? Which files do I have to alter to have the driver seen from the IE? Please take note that when I am in the same directory, that contains both servlet class and non-servlet class, and run the non-servlet class from command line it runs, but when I try accessing the servlet version of the program it then fails.
Regards Alisemore Dudzai Ndowora ----- Original Message ----- From: jmt <[EMAIL PROTECTED]> To: <[email protected]>; FTL Africa <[EMAIL PROTECTED]> Sent: Friday, January 24, 2003 7:16 PM Subject: Re: ACCESSING DATABASE THROUGH SERVLET CALLED FROM INTERNET EXPLORER > This is caused by your program not finding the "driver" class. Your > web-application should contain a directory "lib" where it could find the > driver, or you could start your application container in a way its CLASSPATH > points to it. > > jmt > > > On Friday 24 January 2003 18:08, FTL Africa wrote: > > Hi! > > > > I am having an error message: > > Error: Error org.apache.xindice.client.xmldb.DatabaseImpl > > when the my program gets to: > > Class c = Class.forName(driver); > > > > I am accessing the program from IE browser not command line > > as is the case with the example RetrieveDocument.java. > > I wrote the following code following the example RetrieveDocument.java that > > came with xindice: > > > > import java.io.*; > > import javax.servlet.*; > > import javax.servlet.http.*; > > import org.xmldb.api.base.*; > > import org.xmldb.api.modules.*; > > import org.xmldb.api.*; > > import org.w3c.dom.*; > > > > public class XindiceServlet7 extends HttpServlet { > > > > // The method corresponding to HTTP GET > > public void doGet(HttpServletRequest request, HttpServletResponse > > response) > > throws ServletException, IOException { > > Collection col = null; > > PrintWriter out = response.getWriter(); > > try { > > String driver = > > "org.apache.xindice.client.xmldb.DatabaseImpl"; > > Class c = Class.forName(driver); /* exception from > > here*/ > > > > Database database = (Database) c.newInstance(); > > DatabaseManager.registerDatabase(database); > > col = > > > > DatabaseManager.getCollection("xmldb:xindice:///db/addressbook"); > > > > XMLResource document = (XMLResource) > > col.getResource("address"); > > if (document != null) { > > out.println("Document "); > > } else { > > out.println("Document not found"); > > } > > } catch(Exception e) { > > out.write("Error " + e.getMessage()); > > } > > finally { > > } > > } > > } > > > > > > Thanks in advance > > > > Alisemore Ndowora >
