wood burning stoves 2.0*
The moose likes JSP and the fly likes Problem connecting with MySQL using JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem connecting with MySQL using JSP" Watch "Problem connecting with MySQL using JSP" New topic
Author

Problem connecting with MySQL using JSP

ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

I am getting the below error while i try to connect the Mysql server using jsp. I have installed the connector jar file for mysql & then also i am getting the below error.

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /try.jsp:26

23: try
24: {
25: Class.forName("com.mysql.jdbc.Driver").newInstance();
26: con = DriverManager.getConnection("jdbc:mysql://localhost:3306/tmp","root","helpdesk");
27: stmt = con.createStatement();
28: }
29: catch(SQLException e)


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

root cause

javax.servlet.ServletException: Could not initialize class com.mysql.jdbc.ConnectionImpl
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.try_jsp._jspService(try_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

root cause

java.lang.NoClassDefFoundError: Could not initialize class com.mysql.jdbc.ConnectionImpl
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
java.sql.DriverManager.getConnection(DriverManager.java:549)
java.sql.DriverManager.getConnection(DriverManager.java:181)
org.apache.jsp.try_jsp._jspService(try_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Apache Tomcat/5.5.17




Regards,

Ujjwal B Soni

(Java Software Developer)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

I have installed the connector jar file for mysql
Apparently not. Where did you "install" it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
I am using netbeans for this project as an IDE & i have added it in library.

Regards,

Ujjwal B Soni
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem connecting with MySQL using JSP