ServletFacet servlet = this.project.getFacet(ServletFacet.class);
Node webXML = removeConflictingErrorPages(servlet);
servlet.getConfigFile().setContents(XMLParser.toXMLInputStream(webXML));
WebAppDescriptor config = servlet.getConfig();
WebResourceFacet web = this.project.getFacet(WebResourceFacet.class);
// (prefer /faces/error.xhtml)
String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource("error.xhtml")).get(1);
config.errorPage(404, errorLocation);
config.errorPage(500, errorLocation);
servlet.saveConfig(config);
}