0

I'm having issues trying to configure JSF 2.

I get the following error when starting up my tomcat 7 server locally.

SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! cvc-enumeration-valid: Value '2.0' is not facet-valid with respect to enumeration '[1.2]'. It must be a value from the enumeration.
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:213)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4521)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5004)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:4999)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value '2.0' is not facet-valid with respect to enumeration '[1.2]'. It must be a value from the enumeration.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
    at org.apache.xerces.jaxp.validation.DOMValidatorHelper.beginNode(Unknown Source)
    at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source)
    at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source)
    at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
    at javax.xml.validation.Validator.validate(Validator.java:127)
    at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:434)
    at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:394)
    at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:351)
    ... 5 more

The error happens when I replace the following in faces-config.xml:

<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xi="http://www.w3.org/2001/XInclude" 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-facesconfig_1_2.xsd">

with:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    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-facesconfig_2_0.xsd"
    version="2.0">
Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110

1 Answers1

2

You've JSF 1.2 libs instead of JSF 2.0 libs in the classpath. Remove/upgrade them.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • How can I check what version they are BalsusC? I can see the jsf-impl & jsf-api jars in my libs folder but their is no version name on them. – Thomas Buckley Mar 21 '11 at 10:25
  • The exception indicates that. You can verify it yourself by extracting the JAR and reading `MANIFEST.MF` file. You can also just download and install JSF 2.x yourself at http://javaserverfaces.java.net. – BalusC Mar 21 '11 at 11:21
  • This wasn't obvious, the stack trace says nothing about the version of JSF, and this answer just was right. In my case, JSF libs were not only in webapps libs dir as expected but also in server common libs dir, and it tried to load these for some reason. I did not work out why, I could just delete them from there. – Schlangi Mar 27 '14 at 12:17
  • @Schlangi: the exception message *"Value '2.0' is not facet-valid with respect to enumeration '[1.2]'"* is obvious enough. It says that the only valid value is "1.2" which in turn indicates that JSF 1.2 is currently being used (it's being thrown while parsing the `` value and validating it against the schema). – BalusC Mar 27 '14 at 12:51
  • @BalusC: Oh, you are right. My stack strace was slightly different and did not include the version information. I did not notice it here, because the rest of the exception looked the same (including line numbers). That was, maybe, because it was the other way around for me: My app is pretty old and now installed on newer tomcat server, so the tomcat comes with preinstalled version 2, and my app needs to have 1.2 – Schlangi Mar 28 '14 at 14:51