title: JNDI lookup fails when using hikari cp for mysql driver
body: <p>I have put the resource info inside context.xml under META-INF of my webapp,
  The following is the context.xml file</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>&lt;Resource name="jdbc/MysqlHikari" 
      auth="Container"
      factory="com.zaxxer.hikari.HikariJNDIFactory" 
      type="javax.sql.DataSource"
      maximumPoolSize="10" 
      connectionTimeout="10000"
      jdbcUrl="jdbc:mysql://127.0.0.1:3306/testdb?verifyServerCertificate=false&amp;amp;useSSL=true"
      driverClassName="com.cj.mysql.jdbc.Driver"
      dataSource.implicitCachingEnabled="true"
      dataSource.cachePrepStmts="true"
      dataSource.prepStmtCacheSize="250"
      dataSource.prepStmtCacheSqlLimit="2048"
      dataSource.user="root"
      dataSource.password="root" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>The mysql connector/j version in use is 6.0.6
  java version is 1_8_161</p>
  
  <p>I am trying to perform a lookup using the following</p>
  
  <pre><code>    try {
  
          Context ctx = new InitialContext();
  
          ds = (HikariDataSource)ctx.lookup("java:/comp/env/jdbc/MysqlHikari");
  
      }catch(Exception e) {
          LOG.error("Error looking up datasource "+e.toString());
      }
  </code></pre>
  
  <p>This is done inside the init method
  The lookup however keeps failing with the following stack trace</p>
  
  <pre><code>[23-Feb-2018 14:50:48.438] [com.zaxxer.hikari.HikariConfig] [DEBUG] - Driver class com.cj.mysql.jdbc.Driver not found in Thread context class loader WebappClassLoader
  context: Servelet
  delegate: false
  ----------&gt; Parent Classloader:
  java.net.URLClassLoader@13221655
  , trying classloader WebappClassLoader
  context: Servelet
  delegate: false
  ----------&gt; Parent Classloader:
  java.net.URLClassLoader@13221655
  
  [23-Feb-2018 14:50:48.440] [com.zaxxer.hikari.HikariConfig] [ERROR] - Failed to load driver class com.cj.mysql.jdbc.Driver from HikariConfig class classloader WebappClassLoader
  context: Servelet
  delegate: false
  ----------&gt; Parent Classloader:
  java.net.URLClassLoader@13221655
  
  [23-Feb-2018 14:50:48.441] [com.zaxxer.hikari.util.PropertyElf] [ERROR] - Failed to set property driverClassName on target class com.zaxxer.hikari.HikariConfig
  java.lang.reflect.InvocationTargetException: null
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.zaxxer.hikari.util.PropertyElf.setProperty(PropertyElf.java:146)
  at com.zaxxer.hikari.util.PropertyElf.lambda$setTargetFromProperties$0(PropertyElf.java:57)
  at java.util.Hashtable.forEach(Hashtable.java:878)
  at com.zaxxer.hikari.util.PropertyElf.setTargetFromProperties(PropertyElf.java:52)
  at com.zaxxer.hikari.HikariConfig.&lt;init&gt;(HikariConfig.java:135)
  at com.zaxxer.hikari.HikariJNDIFactory.createDataSource(HikariJNDIFactory.java:71)
  at com.zaxxer.hikari.HikariJNDIFactory.getObjectInstance(HikariJNDIFactory.java:59)
  at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
  at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157)
  at javax.naming.InitialContext.lookup(InitialContext.java:417)
  at foodiniq.CheckProValidityServelet.init(CheckProValidityServelet.java:61)
  at javax.servlet.GenericServlet.init(GenericServlet.java:158)
  at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
  at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.RuntimeException: Failed to load driver class com.cj.mysql.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
  at com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:512)
  ... 44 common frames omitted
  </code></pre>