title: Cannot create JDBC driver of class '' for connect URL 'null'
body: <p>I'm using Tomcat 7.0.12 and receiving this error whenever I attmept to access a JNDI datasource connecting to a postgresql db via a .jsp page in a webapp called 'ROOT':</p>
  
  <pre><code>SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception
  [java.lang.RuntimeException: Cannot create JDBC driver of class '' for connect URL 'null'] with root cause
  java.lang.NullPointerException
  at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
  at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
  at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
  at java.sql.DriverManager.getDriver(DriverManager.java:253)
  at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
  at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
  at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
  </code></pre>
  
  <p>The postgresql JDBC driver is in my CATALINA/lib folder.</p>
  
  <p>Here is my META-INF/context.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;Context&gt;
  
  &lt;Resource name="jdbc/webdbro" auth="Container" type="javax.sql.DataSource"
      driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/webdb"
      username="webdbro" password="pass" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="30"/&gt;
  
  &lt;Resource name="jdbc/webdbrw" auth="Container" type="javax.sql.DataSource"
      driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/webdb"
      username="webdbrw" password="pass" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="30"/&gt;
  
  &lt;Resource name="jdbc/shadowdbro" auth="Container" type="javax.sql.DataSource"
      driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/shadowdb"
      username="shadowdbro" password="pass" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="30"/&gt;
  
  &lt;/Context&gt;
  </code></pre>
  
  <p>Here is my WEB-INF/web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID" version="3.0"&gt;
  &lt;display-name&gt;ROOT&lt;/display-name&gt;
  
  &lt;resource-ref&gt;
      &lt;description&gt;Read only webdb connector.&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/webdbro&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;/resource-ref&gt;
  &lt;resource-ref&gt;
      &lt;description&gt;Read write webdb connector.&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/webdbrw&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;/resource-ref&gt;
  &lt;resource-ref&gt;
      &lt;description&gt;Read only shadow db connector.&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/shadowdbro&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;/resource-ref&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>The weird thing is that I have 2 other webapps running on the same Tomcat server using the exact same configuration (web.xml and context.xml) so they can use the JNDI method to connect to the database and BOTH of those webapps work perfectly fine - I can query and update the database with no problems or exceptions in those apps. TIA...</p>