title: InitialContext issue with Eclipse
body: <p>I am getting the following error message:</p>
  
  <pre><code>javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
          at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
          at javax.naming.InitialContext.lookup(InitialContext.java:392)
          at edu.neu.cs5200.Homework4.UserManager.getConnection(UserManager.java:31)
          at edu.neu.cs5200.Homework4.UserManager.createUser(UserManager.java:55)
          at edu.neu.cs5200.Homework4.UserManager.main(UserManager.java:95)
  Exception in thread "main" java.lang.NullPointerException
          at edu.neu.cs5200.Homework4.UserManager.createUser(UserManager.java:58)
          at edu.neu.cs5200.Homework4.UserManager.main(UserManager.java:95)
  </code></pre>
  
  <p>within web.xml (within Web-INF folder)</p>
  
  <p>I have this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;Homework4&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
    &lt;resource-ref&gt;
          &lt;description&gt;Homework 4 MySQL Data Source&lt;/description&gt;
          &lt;res-ref-name&gt;jdbc/DBHomework4&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;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Then, Within tomcat's context.xml I have this:</p>
  
  <pre><code>  &lt;Resource name="jdbc/DBHomework4" auth="Container" type="javax.sql.DataSource"
                 maxActive="100" maxIdle="30" maxWait="10000"
                 username="root" password="root"
                 driverClassName="com.mysql.jdbc.Driver"
                 url="jdbc:mysql://localhost:8889/Homework4"/&gt;
  </code></pre>
  
  <p>All this should be correct, yet I am still getting the InitialContext error. Any ideas?</p>