title: Cannot create resource instance. javax.naming
body: <p>trying to use tomcat pool to connect to  the database.</p>
  
  <p>Here is my code :</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;resource-ref&gt;
     &lt;description&gt;Resource pour le pool de connexion vers tomcat&lt;/description&gt;
     &lt;res-ref-name&gt;jdbc/pool&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>context.xml :</p>
  
  <pre><code>&lt;Context antiJARLocking="true" path="/CompteBancaire"&gt;
      &lt;Resource name="jdbc/pool" auth="container" type="javax.sql.Datasource"&gt;
          &lt;ResourceParams name="jdbc/pool"&gt;
              &lt;parameter&gt;
                  &lt;name&gt;username&lt;/name&gt;
                  &lt;value&gt;marc&lt;/value&gt;
              &lt;/parameter&gt;
              &lt;parameter&gt;
                  &lt;name&gt;password&lt;/name&gt;
                  &lt;name&gt;marc&lt;/name&gt;
              &lt;/parameter&gt;
              &lt;parameter&gt;
                  &lt;name&gt;driverClassName&lt;/name&gt;
                  &lt;value&gt;oracle.jdbc.driver.OracleDriver&lt;/value&gt;
              &lt;/parameter&gt;
              &lt;parameter&gt;
          &lt;name&gt;url&lt;/name&gt;
          &lt;value&gt;jdbc:oracle:thin:@localhost:1521:xe&lt;/value&gt;
              &lt;/parameter&gt;
              &lt;parameter&gt;
                  &lt;name&gt;factory&lt;/name&gt;
                  &lt;value&gt;org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory&lt;/value&gt;
              &lt;/parameter&gt;
          &lt;/ResourceParams&gt;
      &lt;/Resource&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>in the constructor of my DAO class :</p>
  
  <pre><code>DataSource ds;
  
  //récupération de la source de donnée
  Context initCtx = new InitialContext();
  ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/pool");
  
  conn = ds.getConnection();
  </code></pre>
  
  <p>I have an exeption trying to look up^and create the datasource :</p>
  
  <pre><code>GRAVE: null
  javax.naming.NamingException: Cannot create resource instance
          at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
          at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
          at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
          at javax.naming.InitialContext.lookup(InitialContext.java:392)
          at cb.model.dao.BankDAONatural.&lt;init&gt;(BankDAONatural.java:35)
          at cb.model.dao.BankDAONatural.getInstance(BankDAONatural.java:42)
          at cb.model.dao.DAOFactory.&lt;init&gt;(DAOFactory.java:31)
          at cb.model.dao.DAOFactory.getInstance(DAOFactory.java:37)
          at cb.control.generalDispatcher.init(generalDispatcher.java:33)
          at javax.servlet.GenericServlet.init(GenericServlet.java:212)
          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
          at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
          at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>Thank you. It is probably something I did not get concerning datasources</p>