title: Jetty mysql connection-pool configuration error: javax.naming.NameNotFoundException; remaining name 'env/jdbc/---(mysql 5.0+jetty 7.0.1)
body: <p>My configuration files</p>
  
  <p><em>project/WEB-INF/web.xml</em>:</p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;description&gt;ConnectionPool DataSource Reference&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/mysql&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>project/WEB-INF/jetty-env.xml:</p>
  
  <pre><code>&lt;New id="mysql" class="org.eclipse.jetty.plus.jndi.Resource"&gt;
      &lt;Arg&gt;&lt;/Arg&gt;
  &lt;Arg&gt;jdbc/mysql&lt;/Arg&gt;
      &lt;Arg&gt;
          &lt;New class="org.apache.commons.dbcp.BasicDataSource"&gt;
              &lt;Set name="driverClassName"&gt;com.mysql.jdbc.Driver&lt;/Set&gt;
              &lt;Set name="url"&gt;jdbc:mysql://localhost:3306/db&lt;/Set&gt;
              &lt;Set name="username"&gt;user&lt;/Set&gt;
              &lt;Set name="password"&gt;pwd&lt;/Set&gt;
              &lt;Set name="maxActive"&gt;50&lt;/Set&gt;
          &lt;/New&gt;
      &lt;/Arg&gt;
  &lt;/New&gt;
  </code></pre>
  
  <hr>
  
  <h2>code to invoke:</h2>
  
  <pre><code>ctx = new InitialContext();
  ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mysql");
  con=ds.getConnection();
  </code></pre>
  
  <hr>
  
  <p>scripts to start jetty:</p>
  
  <pre><code>java -DOPTIONS=plus -jar start.jar
  
  java -jar start.jar
  </code></pre>
  
  <p>Either way to start jetty, I got following error:</p>
  
  <hr>
  
  <pre><code>javax.naming.NameNotFoundException; remaining name 'env/jdbc/mysql'
          at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:632)
          at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)
          at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)
          at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)
          at javax.naming.InitialContext.lookup(Unknown Source)
  </code></pre>
  
  <hr>
  
  <p>The questions are:</p>
  
  <ul>
  <li>what is the problem here?</li>
  <li>Any other configurations needed?</li>
  <li>where to put following jar files:
  
  <ul>
  <li>commons-dbcp-1.2.2.jar</li>
  <li>mysql-connector-java-5.1.10-bin.jar</li>
  </ul></li>
  </ul>
  
  <p>Thank you!</p>