title: How to bind a servlet to a context?
body: <p>I got</p>
  
  <pre><code>javax.servlet.ServletException: Error instantiating servlet class servlets.MemoServlet
  javax.naming.NameNotFoundException: Name servlets.MemoServlet is not bound in this Context
  </code></pre>
  
  <p>when using</p>
  
  <pre><code>&lt;form action="MemoServlet"&gt;
  </code></pre>
  
  <p>I know I could use managedbeans, but I've to use servlets.</p>
  
  <p>I suspect the problem has to do with JSF.</p>
  
  <p><code>context.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context antiJARLocking="true" path="/MemoWeb/faces"/&gt;
  </code></pre>
  
  <p><code>web.xml</code>:</p>
  
  <pre><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;MemoServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/MemoServlet&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;MemoServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;servlets.MemoServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p>I seem to have this problem all over the place:</p>
  
  <pre><code>com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean userManager
  ....
  Caused by: javax.naming.NameNotFoundException: Name user.UserManager is not bound in this Context
  </code></pre>