title: javax.naming.NamingException: Cannot create resource instance
body: <p>I have tried a ton of variants of the below to get datasources to work but to no avail.  I have been researching/trying for a few days now so I'm throwing in the towel and asking for help.  First off though, I am having a hard time formating my code in this post. Nothing is getting indented and certain xml tags are disappearing.  Probably stupid IE that work forces us to use....</p>
  
  <h2>web.xml</h2>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;res-ref-name&gt;jdbc/nalabor&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;
  
  &lt;resource-ref&gt;
      &lt;res-ref-name&gt;jdbc/navarch&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>
  
  <h2>context.xml</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;Context&gt;
    &lt;Resource
      name="jdbc/nalabor" type="oracle.jdbc.pool.OracleDataSource"
      maxActive="1" maxIdle="1" maxWait="10000" 
      factory="oracle.jdbc.pool.OracleDataSourceFactory"
      url="jdbc:oracle:thin:@####.com:1521:SID"
      driverClassName="oracle.jdbc.driver.OracleDriver"
      username="###" password="###"/&gt;
  
    &lt;Resource
      name="jdbc/navarch" type="oracle.jdbc.pool.OracleDataSource"
      maxActive="1" maxIdle="1" maxWait="10000"
      factory="oracle.jdbc.pool.OracleDataSourceFactory"
      url="jdbc:oracle:thin:@####.com:1521:SID"
      driverClassName="oracle.jdbc.driver.OracleDriver"
      username="###" password="###"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <h2>Dao</h2>
  
  <pre><code>try {      
    Context initContext = new InitialContext();
    NamingEnumeration list = initContext.list("java:/comp/env");
    System.out.println("Listing NamingEnumeration For java:/comp/env");
    while (list.hasMore()) {
      NameClassPair nc = (NameClassPair)list.next();
      System.out.println("Name Class Pair = " + nc);
    }
  
    list = initContext.list("java:/comp/env/jdbc");
    System.out.println("Listing NamingEnumeration java:/comp/env/jdbc");
    while (list .hasMore()) {
      NameClassPair nc = (NameClassPair)list .next();
      System.out.println("Name Class Pair = " + nc);
    }
  
    Context envContext = (Context) initContext.lookup("java:/comp/env");
    ods = (OracleDataSource) envContext.lookup("jdbc/nalabor");
  } catch (Exception ex) {
    System.out.println("ERORRRRRRRR AGAIN!");
    ex.printStackTrace();
  }
  </code></pre>
  
  <h2>Stack</h2>
  
  <pre><code>Listing NamingEnumeration For java:/comp/env
  Name Class Pair = mailClient: java.lang.String
  Name Class Pair = siteConnCache: java.lang.String
  Name Class Pair = jdbc: org.apache.naming.NamingContext
  Name Class Pair = sitePOCEmail: java.lang.String
  Name Class Pair = siteFilePrefix: java.lang.String
  Name Class Pair = siteName: java.lang.String
  Name Class Pair = siteEmail: java.lang.String
  
  Listing NamingEnumeration java:/comp/env/jdbc
  Name Class Pair = nalabor: org.apache.naming.ResourceRef
  Name Class Pair = navarch: org.apache.naming.ResourceRef
  ERORRRRRRRR AGAIN!
  javax.naming.NamingException: Cannot create resource instance    
  at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:167)
  at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at com.gdebI.rozycki.bsc.data.LaborDAO.getWeightedLabor(LaborDAO.java:91)
  at com.gdebI.rozycki.bsc.controller.action.WeightedLabor.getList(WeightedLabor.java:66)
  at com.gdebI.rozycki.controller.action.ListAction.service(ListAction.java:38)
  </code></pre>
  
  <h2>WEB-INF/lib</h2>
  
  <pre><code>ojdbc14.jar
  </code></pre>