title: WebSphere: JNDI Context Lookup Failure
body: <p>I have the following...</p>
  
  <pre><code>Context aContext = = new InitialContext(settings);
  aContext.lookup("java:comp/env/DB2_DB");
  </code></pre>
  
  <p>Also tried...</p>
  
  <pre><code>aContext.lookup("DB2_DB");
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;description&gt;
      &lt;/description&gt;
      &lt;res-ref-name&gt;DB2_DB&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Application&lt;/res-auth&gt;
      &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
      &lt;mapped-name&gt;DB2_DB&lt;/mapped-name&gt;
  &lt;/resource-ref&gt;
  </code></pre>
  
  <p>then in my ibm-web-bnd.xml...</p>
  
  <pre><code>&lt;resource-ref name="DB2_DB" binding-name="jdbc/DB2DB" /&gt;
  </code></pre>
  
  <p>In Websphere I see the binding name in resources>JDBC>Data Sources</p>
  
  <p>But when I run my application I see...</p>
  
  <blockquote>
    <p>Caused by: javax.naming.NameNotFoundException: Context: Node04Cell/nodes/Node04/servers/server1, name: DB2_DB: First component in name DB2_DB not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]^M</p>
  </blockquote>
  
  <p>This is a port project from WAS6-8.5</p>