title: javax.naming.NamingException: Cannot create resource instance issue
body: <p>While running this sample code in eclipse (the issue is not related to JSF though) i get the error javax.naming.NamingException: Cannot create resource instance</p>
  
  <p><strong>Java file</strong> </p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import javax.annotation.Resource;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  import javax.sql.DataSource;
  @SessionScoped
  public class CustomerBean implements Serializable{
  
      //resource injection
      @Resource(name="jdbc/SSHD")
      private DataSource ds;
  
      //if resource inject is not support, you still can get it manually.
      public CustomerBean(){
          try {
              System.out.println("11111111111111");
  
              Context ctx = new InitialContext();
              System.out.println("222222222222222222");
              ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SSHD");
          } catch (NamingException e) {
              System.out.println("3333333333333333333");
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p><strong>webapp/WEB-INF/web.xml</strong></p>
  
  <pre><code>&lt;resource-ref&gt;
     &lt;description&gt;SSHD Connection&lt;/description&gt;
     &lt;res-ref-name&gt;jdbc/SSHD&lt;/res-ref-name&gt;
     &lt;res-type&gt;oracle.jdbc.pool.OracleDataSource&lt;/res-type&gt;
     &lt;res-auth&gt;Container&lt;/res-auth&gt;
   &lt;/resource-ref&gt;
  </code></pre>
  
  <p><strong>webapp/META-INF/context.xml</strong></p>
  
  <pre><code>&lt;Context&gt;
  
    &lt;Resource name="jdbc/SSHD" auth="Container" type="oracle.jdbc.pool.OracleDataSource"
                 maxActive="100" maxIdle="30" maxWait="10000"
                 username="ABCD" password="XYZZ" driverClassName="oracle.jdbc.driver.OracleDriver"
                 url="jdbc:oracle:thin:@XX.XX.XX.XXXX:1521:SSHD"/&gt;
  
  &lt;/Context&gt;
  </code></pre>
  
  <p><strong>webapp/WEB-INF/lib</strong></p>
  
  <pre><code>classes12.jar
  </code></pre>
  
  <p><strong>error stack</strong></p>
  
  <pre><code>11111111111111
  javax.naming.NamingException: Cannot create resource instance
  222222222222222222
  3333333333333333333
      at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:146)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
  </code></pre>
  
  <p>Please advise</p>