title: comp/env/pool not found in context "java:"?
body: <p>I have a web application trying to access a JNDI declared in WebSphere Application Server.
  The JNDI is declared under <code>Object pool managers</code>. However, I'm receiving an error when I access the pool. The error says that <code>comp/env/pool is not found in context "java:"</code>.</p>
  
  <p>My code is written as follows:</p>
  
  <pre><code>InitialContext initialContext = new InitialContext();
  ObjectPoolManager opm = (ObjectPoolManager)initialContext.lookup("java:comp/env/pool");
  </code></pre>
  
  <p>Accessing the pool via the code below works:</p>
  
  <pre><code>ObjectPoolManager opm = (ObjectPoolManager)initialContext.lookup("pool");
  </code></pre>
  
  <p>I'm confused because according to what I've found on the internet, <code>java:comp/env/</code> is a default prefix for JNDI. So why does it cause an error in my case?</p>
  
  <p>Thank you!</p>