title: Tomcat Netbeans DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc
body: <p>I just follow the practice of Creating a Simple Web Application Using a MySQL Database on Netbeans page and encountered an error. </p>
  
  <p>I couldn't run my initial steps with glassfish so install tomcat and it worked fine for simpler version. After adding the MySQL DB. I have defined a JDBC Resource utilizing Netbeans glassfish functionality as document explained. However I refer these resource under my web.xml and glassfish-resources.xml, I am encountering the error.</p>
  
  <p>I think that I should define the jdbc source to tomcat in a different way than whatever tutorial showed to notice it but I am a newbie and doesn't have too much background.</p>
  
  <p>I will appreciate if you could give me some idea or a reference document which is easy to understand for a newbie. </p>
  
  <p>Here is the log file.</p>
  
  <blockquote>
    <p>TTP Status 500 - An exception occurred processing JSP page /index.jsp at line 9
    type Exception report
    message An exception occurred processing JSP page /index.jsp at line 9
    description The server encountered an internal error that prevented it from fulfilling this request.</p>
    
    <p>exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 9<br>
    6:     Author     : XXX<br>
    7: --%><br>
    8:<br>
    9: <br>
    10:     SELECT subject_id, name FROM subject<br>
    11: <br>
    12:     </p>
  </blockquote>
  
  <p>Stacktrace:</p>
  
  <pre><code>org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
  </code></pre>
  
  <p>root cause</p>
  
  <pre><code>javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/IFPNEW"
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:906)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:835)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:153)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
  </code></pre>
  
  <p>root cause</p>
  
  <pre><code>javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/IFPNEW"
  org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:318)
  org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:201)
  org.apache.jsp.index_jsp._jspx_meth_sql_005fquery_005f0(index_jsp.java:175)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
  </code></pre>
  
  <p>context.xml</p>
  
  <pre><code>       &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context antiJARLocking="true" path="/tompool"&gt;
    &lt;!-- maxActive: Maximum number of database connections in pool. Make sure you
           configure your mysqld max_connections large enough to handle
           all of your db connections. Set to -1 for no limit.
           --&gt;
    &lt;!-- maxIdle: Maximum number of idle database connections to retain in pool.
           Set to -1 for no limit.  See also the DBCP documentation on this
           and the minEvictableIdleTimeMillis configuration parameter.
           --&gt;
    &lt;!-- maxWait: Maximum time to wait for a database connection to become available
           in ms, in this example 10 seconds. An Exception is thrown if
           this timeout is exceeded.  Set to -1 to wait indefinitely.
           --&gt;
    &lt;!-- username and password: MySQL username and password for database connections  --&gt;
    &lt;!-- driverClassName: Class name for the old mm.mysql JDBC driver is
           org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
           Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
           --&gt;
    &lt;!-- url: The JDBC connection url for connecting to your MySQL database.
           --&gt;
    &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/IFPNEW" password="...." type="javax.sql.ConnectionPoolDataSource" url="jdbc:mysql://localhost:3306/connpool" username="....."/&gt;
  &lt;/Context&gt;
  </code></pre>