title: HTTP 500 - Cannot create JDBC driver of class '' for connect URL 'null'
body: <p>I have been searching to fix that problem for 3 days reading forums... Then I decided to ask for some help.  Nedless to say that your help would be highly appreciated :-)</p>
  
  <p>I created a jndi resource for the mysql connexion in Tomcat context.xml instance in Eclipse
  My web app works fine when I start the server from eclipse.  It doesn't work fine when I start the web app from eclipse 'Run configurations' with that goals : clean tomcat7:run.  My aim is to delegate the build, deploy, start server to maven from eclipse.</p>
  
  <p>I've put the mysql-connector-java-5.1.27.jar in Tomcat_Home/lib.</p>
  
  <p>I don't want to put the datasource configuration in the app (no META-INF....) as one goal of jndi is to place the datasource info out of the app.</p>
  
  <p>Thank you for reading and for the time you'll spend to find a solution.</p>
  
  <p>Technical specifications</p>
  
  <ul>
  <li>eclipse : juno release2  </li>
  <li>spring tool suite : 3.4</li>
  <li>wtp</li>
  <li>m2e : 1.4</li>
  <li>maven : 3.0.2</li>
  <li>jdk : 1.6.21</li>
  <li><p>tomcat : 7.0.25</p>
  
  <p>mysql : 5.6.14</p></li>
  </ul>
  
  <p>stacktrace</p>
  
  <pre><code>type Exception report
  
  message Request processing failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; 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.CannotGetJdbcConnectionException: Could not get JDBC Connection; 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:927)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  
  
  root cause 
  
  org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
      org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
      org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:662)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:702)
      org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:178)
      com.marc.springmvc3.dao.PersonDAO.getPersonById(PersonDAO.java:26)
      com.marc.springmvc3.service.PersonService.getAllPersons(PersonService.java:18)
      com.marc.springmvc3.mvc.PersonController.getListOfPerson(PersonController.java:33)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
      org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123)
      org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:723)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)
      org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  
  
  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.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:662)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:702)
      org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:178)
      com.marc.springmvc3.dao.PersonDAO.getPersonById(PersonDAO.java:26)
      com.marc.springmvc3.service.PersonService.getAllPersons(PersonService.java:18)
      com.marc.springmvc3.mvc.PersonController.getListOfPerson(PersonController.java:33)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
      org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123)
      org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:723)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)
      org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  
  
  root cause 
  
  java.lang.NullPointerException
      sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
      sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
      sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
      java.sql.DriverManager.getDriver(DriverManager.java:253)
      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.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:662)
      org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:702)
      org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:178)
      com.marc.springmvc3.dao.PersonDAO.getPersonById(PersonDAO.java:26)
      com.marc.springmvc3.service.PersonService.getAllPersons(PersonService.java:18)
      com.marc.springmvc3.mvc.PersonController.getListOfPerson(PersonController.java:33)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
      org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123)
      org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:723)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)
      org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  
  
  note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                      http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.marc&lt;/groupId&gt;
  &lt;artifactId&gt;spring-mvc-3&lt;/artifactId&gt;
  &lt;name&gt;spring-mvc-3&lt;/name&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;1.0.0-BUILD-SNAPSHOT&lt;/version&gt;
  
  &lt;properties&gt;
      &lt;java-version&gt;1.6&lt;/java-version&gt;
      &lt;org.springframework-version&gt;3.2.0.RELEASE&lt;/org.springframework-version&gt;
      &lt;org.aspectj-version&gt;1.6.10&lt;/org.aspectj-version&gt;
      &lt;org.slf4j-version&gt;1.6.1&lt;/org.slf4j-version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;!-- Spring --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
               &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- AspectJ --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
          &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
          &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
      &lt;/dependency&gt;   
  
      &lt;!-- Logging --&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.16&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- @Inject --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.inject&lt;/groupId&gt;
          &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
          &lt;version&gt;1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- JSR 303 with Hibernate Validator --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.GA&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;4.1.0.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!--  MYSQL driver--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.27&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- JDBC --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework-version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
          &lt;version&gt;20030825.184428&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Test --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mockito&lt;/groupId&gt;
          &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;
          &lt;version&gt;1.9.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.10&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;spring-mvc-3&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;!-- Maven Tomcat Plugin --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;url&gt;http://127.0.0.1:8080/manager/text&lt;/url&gt;
                  &lt;server&gt;TomcatServer&lt;/server&gt;
                  &lt;path&gt;/${project.build.finalName}&lt;/path&gt;
                  &lt;port&gt;8080&lt;/port&gt;
                  &lt;charset&gt;UTF-8&lt;/charset&gt;
                  &lt;finalName&gt;${project.build.finalName}&lt;/finalName&gt;
                  &lt;username&gt;ssss&lt;/username&gt;
                  &lt;password&gt;dddddddddd&lt;/password&gt;
              &lt;/configuration&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;mysql&lt;/groupId&gt;
                      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
                      &lt;version&gt;5.1.27&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/plugin&gt;
  
          &lt;!-- Maven compiler plugin --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.2&lt;/version&gt;                
              &lt;configuration&gt;
                  &lt;source&gt;${java-version}&lt;/source&gt;
                  &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>Servers/tomcat-config/tomcat-users.xml (in Eclipse)</p>
  
  <pre><code>    &lt;role rolename="admin"/&gt;
    &lt;user username="ssss" password="dddddddddd" roles="admin"/&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;web-app id="WebApp_ID" version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
                          http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  
      &lt;display-name&gt;Spring Web MVC Application&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;!-- database jndi reference --&gt;
      &lt;description&gt;MySQL Test App&lt;/description&gt;
      &lt;resource-ref&gt;
          &lt;description&gt;DB Connection&lt;/description&gt;
          &lt;res-ref-name&gt;jdbc/TestDB&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;/web-app&gt;
  </code></pre>
  
  <p>mvc-dispatcher-servlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jee="http://www.springframework.org/schema/jee"
      xmlns:util="http://www.springframework.org/schema/util"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:p="http://www.springframework.org/schema/p"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/jee 
          http://www.springframework.org/schema/jee/spring-jee-3.2.xsd"&gt;
  
      &lt;jee:jndi-lookup id="dataSource"
          jndi-name="jdbc/TestDB"
          expected-type="javax.sql.DataSource"
          resource-ref="true"/&gt;   
  
      &lt;bean id="personDao" class="com.marc.springmvc3.dao.PersonDAO"&gt;
          &lt;property name="dataSource" ref="dataSource"/&gt;
          &lt;/bean&gt; 
  </code></pre>
  
  <p>tomcat context.xml (in eclipse) </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context&gt;
  
      &lt;!-- Default set of monitored resources --&gt;
      &lt;WatchedResource&gt;WEB-INF/web.xml&lt;/WatchedResource&gt;
  
      &lt;!-- Uncomment this to disable session persistence across Tomcat restarts --&gt;
      &lt;!--
      &lt;Manager pathname="" /&gt;
      --&gt;
  
      &lt;!-- Uncomment this to enable Comet connection tacking (provides events
           on session expiration as well as webapp lifecycle) --&gt;
      &lt;!--
      &lt;Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /&gt;
      --&gt;
  
   &lt;Resource  name="jdbc/TestDB" 
              username="xxx" 
              password="xxxxxxxx" 
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/mytest"
              auth="Container" 
              type="javax.sql.DataSource"
              maxActive="100" 
              maxIdle="30" 
              maxWait="10000"
              initialSize="1"/&gt;
  
  
  &lt;!--      &lt;ResourceLink name="jdbc/TestDB"
          global="jdbc/TestDB"
          type="javax.sql.DataSource"/&gt; --&gt;
  &lt;/Context&gt;
  </code></pre>