2 messages in com.mysql.lists.javaRe: MySQL, Apache and Tomcat| From | Sent On | Attachments |
|---|---|---|
| Piotrowski, Brian | 07 Nov 2000 08:19 | |
| Joshua M. Goldfarb | 07 Nov 2000 09:02 |
| Subject: | Re: MySQL, Apache and Tomcat![]() |
|---|---|
| From: | Joshua M. Goldfarb (jmg...@cornell.edu) |
| Date: | 11/07/2000 09:02:30 AM |
| List: | com.mysql.lists.java |
Hi Brian,
I believe that you want to add "/usr/local/mysql" to CLASSPATH and not the rest of what you've added.
I hope this helps.
Thanks,
Josh On Tue, 7 Nov 2000, Piotrowski, Brian wrote:
Hi Folks,
I'm finally at the point where I can parse JSP files through apache. Now the next step I am attempting is to get JSP and MySQL to live in harmony. So far I have done the following:
- Downloaded and extracted the mm.mysql driver into /usr/local/mysql/mm.mysql.jdbc-2.0pre5/ - Added the line CLASSPATH="/usr/local/mysql/mm.mysql.jdbc-2.0pre5" to the file /etc/profile - Added the line TOMCAT_HOME="/usr/local/jakarta-tomcat" to the file /etc/profile - Added the line "include /usr/local/jakarta-tomcat/conf/tomcat-apache.conf" to httpd.conf in the Apache conf directory - Add the line CLASSPATH=${CLASSPATH}:/usr/local/mysql/mm.mysql.jdbc-2.0pre5/mysql_2_comp.j ar to TOMCAT.SH in the tomcat/bin directory
When I try a simple SELECT statement from a MySQL table, I get the error:
Error: 500 Location: /examples/jsp/test/bp.jsp Internal Servlet Error: javax.servlet.ServletException: Unable to load class org.gjt.mm.mysql.Driver at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java, Compiled Code) at jsp.test._0002fjsp_0002ftest_0002fbp_0002ejspbp_jsp_2._jspService(_0002fjsp_ 0002ftest_0002fbp_0002ejspbp_jsp_2.java, Compiled Code) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja va, Compiled Code) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java, Compiled Code) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code) at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection (Ajp12ConnectionHandler.java, Compiled Code) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code) at java.lang.Thread.run(Thread.java, Compiled Code) Root cause: java.lang.ClassNotFoundException: Unable to load class org.gjt.mm.mysql.Driver at org.apache.jasper.runtime.JspLoader.findClass(JspLoader.java, Compiled Code) at org.apache.jasper.runtime.JspLoader.loadClass(JspLoader.java, Compiled Code) at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java, Compiled Code) at jsp.test._0002fjsp_0002ftest_0002fbp_0002ejspbp_jsp_2._jspService(_0002fjsp_ 0002ftest_0002fbp_0002ejspbp_jsp_2.java, Compiled Code) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja va, Compiled Code) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java, Compiled Code) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code) at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection (Ajp12ConnectionHandler.java, Compiled Code) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code) at java.lang.Thread.run(Thread.java, Compiled Code)
---------------------
Here is the code I am using to display the page:
<html> <%@ page language ="java" import="java.sql.*" %> <BODY> <TABLE border="1" width="500"> <TR> <TD><B>ID</B></TD><TD><B>Name</B></TD> </TR> <% Class.forName("org.gjt.mm.mysql.Driver"); Connection myConn = DriverManager.getConnection("jdbc:mysql:test"); Statement stmt = myConn.createStatement(); ResultSet myResultSet = stmt.executeQuery("select * from brian"); if (myResultSet !=null) { while (myResultSet.next()) { String eid = myResultSet.getString("client_id"); String myname = myResultSet.getString("name"); %> <TR> <TD><%= eid %></TD> <TD><%= myname %></TD> </TR> <% } } stmt.close(); myConn.close(); %> </TABLE> </BODY> </HTML>
I checked, and there IS a file Driver.class under /usr/local/mysql/mm.mysql.jdbc-2.0pre5/org/gjt/mm/mysql! Can someone PLEASE tell me what I am doing wrong???? It's been driving me CRAZY for the last few days!!!!
One other tidbit of information (I don't know if this is important or not) - when I start Tomcat (using ./Tomcat start), the first two messages are "Guessing TOMCAT_HOME from tomcat.sh to ./.." and "Setting TOMCAT_HOME to ./.." - Should it not assume "TOMCAT_HOME = /usr/local/jakarta-tomcat" since I specified it in /etc/profile?
Thanks in advance!
Brian.
----------------------------------- Brian Piotrowski Developer / Network Administrator Moneyramp.com (705) 475-9531 www.moneyramp.com
-----------------------------------
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
-- Joshua M. Goldfarb Web Developer Academic Technology Center 124 CCC Cornell University Phone: (607) 255-1916 Fax: (607) 255-9145 e-mail: jmg...@cornell.edu




