title: tomcat is ignoring the 'factory' attribute on a Resource
body: <p>In my server.xml, I'm defining a resource:</p>
  
  <pre><code>&lt;Resource name="global" auth="Container" type="javax.sql.DataSource"
            maxTotal="100" maxIdle="30" maxWaitMillis="10000"
            username="user" password="betterThanThis"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
            url="jdbc:derby:memory:test;create=true"/&gt;
  </code></pre>
  
  <p>In my webapp context.xml I'm linking to it:</p>
  
  <pre><code>&lt;ResourceLink name="local"
                auth="Container"
                global="global"
                type="javax.sql.DataSource" /&gt;
  </code></pre>
  
  <p>In my web.xml I'm referencing it</p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;res-ref-name&gt;local&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;
  </code></pre>
  
  <p>And in my code, I'm using it</p>
  
  <pre><code>DataSource ds = InitialContext.doLookup("java:/comp/env/local");
  ds.getConnection();
  </code></pre>
  
  <p>That last line throws an exception:</p>
  
  <pre><code>java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2167) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2037) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
  </code></pre>
  
  <p>Question: Why is a class in the <code>org.apache.tomcat.dbcp.dbcp2</code> package throwing an error when I've specified <code>factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"</code> on my Resource?</p>
  
  <p>It's not a missing jar problem, because I can see the Derby init in tomcat's logs. I don't think it's a naming issue, because when I change the name in <code>InitialContext.doLookup("java:/comp/env/local")</code> I get a naming error.</p>
  
  <p>Edit: Full stack trace as requested:</p>
  
  <pre><code>java.sql.SQLException: No suitable driver
      at java.sql.DriverManager.getDriver(DriverManager.java:315) ~[na:1.8.0_151]
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2151) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      ... 8 common frames omitted
  Wrapped by: java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2167) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2037) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
      at com.moosemorals.webmail.Database.getConnection(Database.java:46) ~[classes/:na]
      at com.moosemorals.webmail.Database.getAccountForAlias(Database.java:55) ~[classes/:na]
      at com.moosemorals.webmail.authserver.PostfixLookupServer.lookup(PostfixLookupServer.java:61) ~[classes/:na]
      at com.moosemorals.webmail.authserver.PostfixLookupServer.execute(PostfixLookupServer.java:40) ~[classes/:na]
      at com.moosemorals.webmail.authserver.GenericServer$Client.run(GenericServer.java:151) [classes/:na]
  </code></pre>