title: Cannot create JDBC driver of class '' for connect URL 'null' : Tomcat + MySQL + Spring MVC
body: <p>For this question I found lot of given answers but unfortunately nothing worked for me. That's why I am posting the question. Your help would be highly appreciated.</p>
  
  <p>My <code>Server.xml</code> in Tomcat under <code>apache-tomcat-7.0.69\conf</code> is as follows:</p>
  
  <p>
      </p>
  
  <pre><code>&lt;Resource name="jdbc/spring_hibernateDB"
    global="jdbc/spring_hibernateDB"
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/spring_hibernate"
    username="test"
    password="password"
    maxActive="100"
    maxIdle="20"
    minIdle="5"
    maxWait="10000"
    /&gt;
  </code></pre>
  
  <p></p>
  
  <p>My <code>context.xml</code> under <code>apache-tomcat-7.0.69\conf</code> is as follows:</p>
  
  <pre><code>&lt;ResourceLink name="jdbc/mySpring_hibernateDB"
      global="jdbc/spring_hibernateDB"
      auth="Container"
      type="javax.sql.DataSource"/&gt;
  </code></pre>
  
  <p>My <code>web.xml</code> is as follows:</p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;res-ref-name&gt;jdbc/mySpring_hibernateDB&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>My <code>Spring-servlet.xml</code> is as follows:</p>
  
  <pre><code>&lt;bean id="jndiDSource" class="org.springframework.jndi.JndiObjectFactoryBean" autowire="byName"&gt;
      &lt;property name="jndiName" value="java:comp/env/jdbc/mySpring_hibernateDB" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mysessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" p:dataSource-ref="jndiDSource" p:mappingResources="employee.hbm.xml"&gt;
  
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And I have included mysql jar at bot in <code>tomcat/lib</code> and in eclipse <code>webapp/lib</code> forlder. when I am running the application I am getting the below error.</p>
  
  <pre><code>HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class '' for connect URL 'null'; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
  
  --------------------------------------------------------------------------------
  
  type Exception report
  
  message Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class '' for connect URL 'null'; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception 
  
  org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class '' for connect URL 'null'; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  
  root cause 
  
  org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class '' for connect URL 'null'; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
      org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
      org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
      org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
      org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:412)
      org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:375)
      org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:585)
      com.abdul.dao.EmployeeDAOImpl.fetchAll(EmployeeDAOImpl.java:38)
      com.abdul.service.EmployeeService.fetchAllEmps(EmployeeService.java:27)
      com.abdul.controller.EmployeeController.displayAllEmps(EmployeeController.java:54)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  
  root cause 
  
  org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
      org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
      org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
      org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
      org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
      org.hibernate.loader.Loader.doQuery(Loader.java:696)
      org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
      org.hibernate.loader.Loader.doList(Loader.java:2228)
      org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
      org.hibernate.loader.Loader.list(Loader.java:2120)
      org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
      org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
      org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
      org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:591)
      org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:585)
      org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:407)
      org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:375)
      org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:585)
      com.abdul.dao.EmployeeDAOImpl.fetchAll(EmployeeDAOImpl.java:38)
      com.abdul.service.EmployeeService.fetchAllEmps(EmployeeService.java:27)
      com.abdul.controller.EmployeeController.displayAllEmps(EmployeeController.java:54)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  
  root cause 
  
  java.lang.NullPointerException
      sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(Unknown Source)
      sun.jdbc.odbc.JdbcOdbcDriver.knownURL(Unknown Source)
      sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(Unknown Source)
      java.sql.DriverManager.getDriver(Unknown Source)
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
      org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
      org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
      org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
      org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
      org.hibernate.loader.Loader.doQuery(Loader.java:696)
  </code></pre>
  
  <p>Please help. Thanks in advance.</p>