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"
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.


Bruno said...

I came across the same problem 5 minutes ago with 1.2 on Glassfish v2. Here's the incantation to resolve it, no DTD but a reference to the XML schema and no DOCTYPE:

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Ganesh Jegadheesan said...

Temporary fix: Add the following context parameter to your web.xml so that faces-config initialization is done without xml validation


Ganesh Jegadheesan said...