Monday, April 30, 2007

cvc-elt.1: Cannot find the declaration of element 'faces-config'

If you get this error while trying to deploy JavaServer Faces (JSF)-based applications, just make sure your faces-config.xml configuration file has the reference:
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
I think the DTD version might have changed (to 1.2?) since I last used the reference implementation from Sun. This is a surprisingly common problem for people just starting out with JSF. A few books I have reviewed don't mention that configuration files (including web.xml) are validated by the container during deployment.