title: Troubleshooting MySQL jdbc database connector error
body: <p>Need help troubleshooting MySQL database connect issue. First, when I run my Java web application on my development workstation I can successfully connect to my remote/hosted MySQL database. </p>
  
  <p>When I deploy my Java web application to my hosted web server I get the following error <code>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'</code></p>
  
  <p>I have the mysql-connector-java-5.1.38.bin.jar located in the WEB-INF/libraries folder within my application.  Like I said before, this seems to work fine when I run my web application on my local development machine, but fails when deployed to my web host.</p>
  
  <p>Tomcat v7.x is running on my development workstation and my web host is using Tomcat v7.x as well. My development workstation is Windows based. I believe the web host is running CentOS7.x. </p>
  
  <p>The other confusing part is my web application worked with my previous web host as written.</p>
  
  <p>How can I get this problem resolved? </p>
  
  <p><strong>EDIT 3/9/2016</strong></p>
  
  <p><strong>Context.xml:</strong></p>
  
  <pre><code>&lt;Resource
      name="jdbc/dbname_ccp"
      auth="Container"
      type="javax.sql.DataSource"
      maxActive="100"
      maxIdle="30"
      maxWait="10000"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://domain.com:3306/dbname_ccp"
      username="username_admin"
      password="dbname_password"
      validationQuery="select 1"
  /&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;description&gt;MySQL Datasource&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/dbname_ccp&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>I believe I have the correct user name, password, and database name since this same connection information works when I run my Java web application from my development workstation.  When Deployed to the hosted web server I get the following error:</p>
  
  <pre><code>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
      at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
      at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at utilities.DBConnection.getConnectionMySQL(DBConnection.java:33)
      at model.account.UserAccountDAO.Register(UserAccountDAO.java:286)
      at model.account.ProcessUserAccount.register(ProcessUserAccount.java:237)
      at controller.AccountServlet.performTask(AccountServlet.java:50)
      at controller.AccountServlet.doPost(AccountServlet.java:76)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.sql.SQLException: No suitable driver
      at java.sql.DriverManager.getDriver(DriverManager.java:278)
      at  org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
      ... 24 more
  </code></pre>
  
  <p>I've tried including the mysql-connector-java-5.1.38-bin.jar file in my project application WEB-INF/lib folder as well as in the tomcat /lib folder.  It doesn't seem to matter where I place the jar, the server deployment always fails with the error listed above.  </p>
  
  <p>How can I get this problem resolved?  Is there any other MySQL connection options?</p>