title: Cannot create resource instance in Tomcat7
body: <p>I'm trying to configure connection pool in Tomcat 7. Here is code:
  part of server.xml:</p>
  
  <pre><code>&lt;GlobalNamingResources&gt;
  &lt;!-- Editable user database that can also be used by
       UserDatabaseRealm to authenticate users
  --&gt;
  &lt;Resource name="UserDatabase" auth="Container"
            type="org.apache.catalina.UserDatabase"
            description="User database that can be updated and saved"
            factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
            pathname="conf/tomcat-users.xml" /&gt;
  
  
  &lt;Resource  
  name="jdbc/testDataSource"                                  
  auth="Container"                                            
  type="javax.sql.DataSource"                                   
  driverClassName="com.mysql.jdbc.Driver"                      
  url="jdbc:mysql://localhost:3306/delta_server"                
  username="test" password="test"                              
  validationQuery="select count (*) from session_contexts"              
  /&gt;
  </code></pre>
  
  <p></p>
  
  <p>web.xml configuration:</p>
  
  <pre><code>&lt;resource-ref&gt; 
      &lt;description&gt; 
          Sample JNDI DataSource resource reference 
      &lt;/description&gt; 
      &lt;res-ref-name&gt;jdbc/testDataSource&lt;/res-ref-name&gt;                   
      &lt;res-type&gt;java.sql.DatSource&lt;/res-type&gt;                           
      &lt;res-auth&gt;Container&lt;/res-auth&gt;                                     
  &lt;/resource-ref&gt; 
  </code></pre>
  
  <p>and access from jsp page:</p>
  
  <pre><code>        Context initialContext = new InitialContext();
          Context envContext = (Context) initialContext.lookup("java:/comp/env");
          conn = (Connection)  envContext.lookup("jdbc/testDataSource");
  </code></pre>
  
  <p>But unfortunately I get exception:</p>
  
  <pre><code>javax.naming.NamingException: Cannot create resource instance
  org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:146)
  javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
  org.apache.naming.NamingContext.lookup(NamingContext.java:826)
  org.apache.naming.NamingContext.lookup(NamingContext.java:145)
  org.apache.naming.NamingContext.lookup(NamingContext.java:814)
  org.apache.naming.NamingContext.lookup(NamingContext.java:159)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  </code></pre>
  
  <p>How can I fix it?
  Thank you. </p>