title: Glassfish 404 error when i run from netbeans (JSF file)
body: <p>i am getting a 404 error as shown below</p>
  
  <pre><code>HTTP Status 404 -
  
  type Status report
  
  message
  
  descriptionThe requested resource () is not available.
  
  GlassFish Server Open Source Edition 3.1.2.2
  </code></pre>
  
  <p>when i run my project, below is my web.xml and sun-web.xml, does anyone have any ideas on what i have missed ?, it was working before i tried to add ldap security </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;Upload Filter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.corejsf.UploadFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;sizeThreshold&lt;/param-name&gt;
              &lt;param-value&gt;1024&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;Upload Filter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/faces/upload/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;faces/index.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
          &lt;param-value&gt;Development&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;facelets.LIBRARIES&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/corejsf.taglib.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
  
      &lt;!--  &lt;security-constraint&gt;
          web resources that are protected 
         &lt;web-resource-collection&gt;
            &lt;web-resource-name&gt;All Resources&lt;/web-resource-name&gt;
            &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
            All methods but OPTIONS must be authenticated. OPTIONS must work without authentication for cross domain in Firefox to work
            &lt;http-method&gt;GETLIB&lt;/http-method&gt;
            &lt;http-method&gt;COPY&lt;/http-method&gt;
            &lt;http-method&gt;MOVE&lt;/http-method&gt;
            &lt;http-method&gt;DELETE&lt;/http-method&gt;
            &lt;http-method&gt;PROPFIND&lt;/http-method&gt;
            &lt;http-method&gt;GET&lt;/http-method&gt;
            &lt;http-method&gt;HEAD&lt;/http-method&gt;
            &lt;http-method&gt;PUT&lt;/http-method&gt;
            &lt;http-method&gt;MKCOL&lt;/http-method&gt;
            &lt;http-method&gt;PROPPATCH&lt;/http-method&gt;
            &lt;http-method&gt;LOCK&lt;/http-method&gt;
            &lt;http-method&gt;UNLOCK&lt;/http-method&gt;
            &lt;http-method&gt;VERSION-CONTROL&lt;/http-method&gt;
            &lt;http-method&gt;CHECKIN&lt;/http-method&gt;
            &lt;http-method&gt;CHECKOUT&lt;/http-method&gt;
            &lt;http-method&gt;UNCHECKOUT&lt;/http-method&gt;
            &lt;http-method&gt;REPORT&lt;/http-method&gt;
            &lt;http-method&gt;UPDATE&lt;/http-method&gt;
            &lt;http-method&gt;CANCELUPLOAD&lt;/http-method&gt;
         &lt;/web-resource-collection&gt;
         &lt;auth-constraint&gt;
              role-name indicates roles that are allowed to access the web resource specified above 
             &lt;role-name&gt;users&lt;/role-name&gt;
         &lt;/auth-constraint&gt;
      &lt;/security-constraint&gt;--&gt;
      &lt;!-- &lt;display-name&gt;Printing from home to uni :)&lt;/display-name&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;login-config&gt;
          &lt;auth-method&gt;FORM&lt;/auth-method&gt;
          &lt;realm-name&gt;LDAP&lt;/realm-name&gt;
          &lt;form-login-config&gt;
              &lt;form-login-page&gt;/login.xhtml&lt;/form-login-page&gt;
              &lt;form-error-page&gt;/login-failed.xhtml&lt;/form-error-page&gt;
          &lt;/form-login-config&gt;
      &lt;/login-config&gt;--&gt;
      &lt;!--
      &lt;security-constraint&gt;
          &lt;display-name&gt;Security&lt;/display-name&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;Secured&lt;/web-resource-name&gt;
              &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
          &lt;/web-resource-collection&gt;
        &lt;auth-constraint&gt;
              &lt;role-name&gt;uid&lt;/role-name&gt;
          &lt;/auth-constraint&gt;
          &lt;user-data-constraint&gt;
              &lt;transport-guarantee&gt;NONE&lt;/transport-guarantee&gt;
          &lt;/user-data-constraint&gt; 
      &lt;/security-constraint&gt;--&gt;
      &lt;login-config&gt;
          &lt;auth-method&gt;FORM&lt;/auth-method&gt;
          &lt;realm-name&gt;LDAP&lt;/realm-name&gt;
          &lt;form-login-config&gt;
              &lt;form-login-page&gt;/login.html&lt;/form-login-page&gt;
              &lt;form-error-page&gt;/login.html&lt;/form-error-page&gt;
          &lt;/form-login-config&gt;
      &lt;/login-config&gt;
      &lt;security-role&gt;
          &lt;role-name&gt;user&lt;/role-name&gt;
      &lt;/security-role&gt;
      &lt;security-constraint&gt;
          &lt;!-- web resources that are protected --&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;All Resources&lt;/web-resource-name&gt;
              &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
              &lt;!-- All methods but OPTIONS must be authenticated. OPTIONS must work without authentication for cross domain in Firefox to work --&gt;
              &lt;http-method&gt;GETLIB&lt;/http-method&gt;
              &lt;http-method&gt;COPY&lt;/http-method&gt;
              &lt;http-method&gt;MOVE&lt;/http-method&gt;
              &lt;http-method&gt;DELETE&lt;/http-method&gt;
              &lt;http-method&gt;PROPFIND&lt;/http-method&gt;
              &lt;http-method&gt;GET&lt;/http-method&gt;
              &lt;http-method&gt;HEAD&lt;/http-method&gt;
              &lt;http-method&gt;PUT&lt;/http-method&gt;
              &lt;http-method&gt;MKCOL&lt;/http-method&gt;
              &lt;http-method&gt;PROPPATCH&lt;/http-method&gt;
              &lt;http-method&gt;LOCK&lt;/http-method&gt;
              &lt;http-method&gt;UNLOCK&lt;/http-method&gt;
              &lt;http-method&gt;VERSION-CONTROL&lt;/http-method&gt;
              &lt;http-method&gt;CHECKIN&lt;/http-method&gt;
              &lt;http-method&gt;CHECKOUT&lt;/http-method&gt;
              &lt;http-method&gt;UNCHECKOUT&lt;/http-method&gt;
              &lt;http-method&gt;REPORT&lt;/http-method&gt;
              &lt;http-method&gt;UPDATE&lt;/http-method&gt;
              &lt;http-method&gt;CANCELUPLOAD&lt;/http-method&gt;
          &lt;/web-resource-collection&gt;
          &lt;auth-constraint&gt;
              &lt;!-- role-name indicates roles that are allowed to access the web resource specified above --&gt;
              &lt;role-name&gt;role1&lt;/role-name&gt;
          &lt;/auth-constraint&gt;
      &lt;/security-constraint&gt; 
  &lt;/web-app&gt;
  </code></pre>
  
  <p>sun-web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd"&gt;
  &lt;sun-web-app error-url=""&gt;
      &lt;context-root&gt;/fileupload&lt;/context-root&gt;
      &lt;class-loader delegate="true"/&gt;
     &lt;!-- &lt;jsp-config&gt;
          &lt;property name="keepgenerated" value="true"&gt;
              &lt;description&gt;Keep a copy of the generated servlet class' java code.&lt;/description&gt;
          &lt;/property&gt;
      &lt;/jsp-config&gt;--&gt;
     &lt;!-- &lt;security-role-mapping&gt;
          &lt;role-name&gt;users&lt;/role-name&gt;
          &lt;group-name&gt;LDAP&lt;/group-name&gt;
      &lt;/security-role-mapping&gt;
      &lt;property name="keepgenerated" value="true"&gt;
          &lt;description&gt;Keep a copy of the generated servlet class java code.&lt;/description&gt;
      &lt;/property&gt;--&gt;
       &lt;security-role-mapping&gt;
          &lt;role-name&gt;user&lt;/role-name&gt;
         &lt;!-- &lt;group-name&gt;Authenticated&lt;/group-name&gt; --&gt;
      &lt;/security-role-mapping&gt;
  &lt;/sun-web-app&gt;
  </code></pre>