----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
I've recently installed ApacheJServ 1.1.2 and it's working. And I've
recently downloaded the mySQL JDBC driver as well. In trying to run the
following code, I get the error unable to load driver error. I'm not real
sure what I should be checking. I've included my CLASSPATH as well as the
directory structure to the drivers. Could anybody point me in the right
direction as to what I should be checking?
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* This is a simple example of an HTTP Servlet. It responds to the GET
* and HEAD methods of the HTTP protocol.
*/
public class Hello extends HttpServlet
{
/**
* Handle the GET and HEAD methods by building a simple web page.
* HEAD is just like GET, except that the server returns only the
* headers (including content length) not the body we write.
*/
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
String title = "Example Apache JServ Servlet";
// set content type and other response header fields first
response.setContentType("text/html");
// then write the data of the response
out = response.getWriter();
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch (Exception E) {
out.println("Unable to load driver.");
E.printStackTrace();
}
out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY bgcolor=\"#FFFFFF\">");
out.println("<H1>" + title + "</H1>");
out.println("<H2> Congratulations, ApacheJServ 1.1.2 is working!<br>");
out.println("</BODY></HTML>");
out.close();
}
}
CLASSPATH=.:/usr/local/jdk/lib/classes.zip:/usr/local/jdk/mySQL:/usr/local/JServ/libexec/ApacheJServ.jar:/usr/local/jsdk/lib/jsdk.jar
4 directories, 37 files
[root@Gandalf mySQL]# tree > tree.out
[root@Gandalf mySQL]# less tree.out
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search Archives:
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]