web-dev-qa-db-fra.com

JSF 2.2 faces-config: Version du schéma inconnu: 2.2

J'essaie d'utiliser les visages 2.2. Je reçois une erreur.

SEVERE: Critical error during deployment: 
com.Sun.faces.config.ConfigurationException: Java.util.concurrent.ExecutionException: com.Sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/server/contracts/WEB-INF/faces-config.xml': Unknown Schema version: 2.2
    at com.Sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.Java:749)
    at com.Sun.faces.config.ConfigManager.initialize(ConfigManager.Java:348)
    at com.Sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.Java:214)
    at org.Apache.catalina.core.StandardContext.contextListenerStart(StandardContext.Java:4750)
    at com.Sun.enterprise.web.WebModule.contextListenerStart(WebModule.Java:550)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5366)
    at com.Sun.enterprise.web.WebModule.start(WebModule.Java:498)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:917)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:901)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:733)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:2019)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:1669)
    at com.Sun.enterprise.web.WebApplication.start(WebApplication.Java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.Java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.Java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.Java:301)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:461)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.Java:389)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.Java:348)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:363)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1085)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.Java:95)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1291)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1259)
    at com.Sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.Java:461)
    at com.Sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.Java:212)
    at com.Sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.Java:179)
    at com.Sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.Java:117)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.Java:354)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.Java:195)
    at com.Sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.Java:860)
    at com.Sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.Java:757)
    at com.Sun.grizzly.http.ProcessorTask.process(ProcessorTask.Java:1056)
    at com.Sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.Java:229)
    at com.Sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.Java:137)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:104)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:90)
    at com.Sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.Java:79)
    at com.Sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.Java:54)
    at com.Sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.Java:59)
    at com.Sun.grizzly.ContextTask.run(ContextTask.Java:71)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.Java:532)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.Java:513)
    at Java.lang.Thread.run(Thread.Java:722)
Caused by: Java.util.concurrent.ExecutionException: com.Sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/server/contracts/WEB-INF/faces-config.xml': Unknown Schema version: 2.2
    at Java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.Java:252)
    at Java.util.concurrent.FutureTask.get(FutureTask.Java:111)
    at com.Sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.Java:747)
    ... 44 more
Caused by: com.Sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/server/contracts/WEB-INF/faces-config.xml': Unknown Schema version: 2.2
    at com.Sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.Java:998)
    at com.Sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.Java:942)
    at Java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.Java:334)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:166)
    at com.Sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.Java:735)
    ... 44 more
Caused by: com.Sun.faces.config.ConfigurationException: Unknown Schema version: 2.2
    at com.Sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.Java:1101)
    at com.Sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.Java:989)
    ... 48 more

faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
              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_2.xsd">
    <application>

        <resource-library-contracts>
            <contract-mapping>
                <url-pattern>/user/*</url-pattern>
                <contracts>blue</contracts>
            </contract-mapping>
            <contract-mapping>
                <url-pattern>*</url-pattern>
                <contracts>red</contracts>
            </contract-mapping>
        </resource-library-contracts>
    </application>
</faces-config>

Le code de cet exemple.

J'ai copié la dernière version de JSF sur le fichier "glassfish3/glassfish/modules/javax.faces.jar".

Je ne comprends pas le problème.

23
Rhododendron

L'espace de noms de schéma pour JSF 2.2 a été modifié. Le faces-config.xml doit ressembler à ceci:

<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
        http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
    version="2.2">

</faces-config>
69
Michi

J'ai eu le même problème avec Eclipse. Je reçois toujours un avertissement ("Pas de coûts de grammaire ..) Mais l'application fonctionne. C'est mon fichier de configuration de faces:

<?xml version="1.0" encoding="UTF-8"?>
 <faces-config
     xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
    version="2.2">


    <application>
            <action-listener>org.primefaces.application.DialogActionListener</action-    listener>
            <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
            <view-handler>org.primefaces.application.DialogViewHandler</view-handler>

        <locale-config>
             <default-locale>de</default-locale>
             <supported-locale>en</supported-locale>
        </locale-config>

        <resource-bundle>
            <base-name>Messages</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>

</faces-config>

Messages est le nom de fichier de base des propriétés. Les fichiers s'appellent Messages.properties (par défaut) et Messages_de.properties.

1
Laura Liparulo

La raison de ce problème est que http://Java.Sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd address est invalide. Par conséquent, je peux vous conseiller d’utiliser le fichier faces-config.xml suivant

<?xml version='1.0' encoding='UTF-8'?>

    <faces-config version="2.2"
        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://www.Oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-facesconfig_2_2.xsd">
       <application>

            <resource-library-contracts>
                <contract-mapping>
                    <url-pattern>/user/*</url-pattern>
                    <contracts>blue</contracts>
                </contract-mapping>
                <contract-mapping>
                    <url-pattern>*</url-pattern>
                    <contracts>red</contracts>
                </contract-mapping>
            </resource-library-contracts>
        </application>

    </faces-config>
0
olyanren