title: javax.naming.NameNotFoundException: Name [jdbc/eswastha] is not bound in this Context. Unable to find [jdbc]
body: <p>I shall describe the environment first </p>
  
  <p><strong>environment:</strong> : <code>Netbeans 7.2 and Tomcat 7.0.27.0 is configured with Netbeans ID</code></p>
  
  <p>when i take the build separately and put it in <code>webapps</code> folder and run than there is no issue but when i run the application in the IDE itself i get <code>javax.naming.NameNotFoundException: Name [jdbc/eswastha] is not bound in this Context. Unable to find [jdbc].</code> this exception.</p>
  
  <p>conf/context.xml</p>
  
  <pre><code>&lt;Resource name="jdbc/eswastha" auth="Container" type="javax.sql.DataSource"
                 maxActive="100" maxIdle="30" maxWait="10000"
                 url="jdbc:mysql://localhost:3306/eswastha"
                 driverClassName="com.mysql.jdbc.Driver"
                 username="root" password="r14@17*" /&gt;
  </code></pre>
  
  <p>and web.xml </p>
  
  <pre><code>&lt;resource-ref&gt;
        &lt;description&gt;DB Connection&lt;/description&gt;
        &lt;res-ref-name&gt;jjdbc/eswastha&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>and the java class : </p>
  
  <pre><code>import java.sql.Connection;
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.sql.DataSource;
  
  public class JDBCManager {
  
      public Connection mysqlConnection()  {
          Connection dbConnection = null;
          try {
  
              Context initContext = new InitialContext();
              Context envContext  = (Context)initContext.lookup("java:/comp/env");
              DataSource ds = (DataSource)envContext.lookup("jdbc/eswastha");
              dbConnection = ds.getConnection();
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          return dbConnection;
  
      }
  }
  </code></pre>
  
  <p>Please help me to identify the issue.</p>
  
  <p>Regards</p>