web-dev-qa-db-ja.com

JSF 2.2 faces-config:不明なスキーマバージョン:2.2

Faces 2.2を使用しようとしています。エラーが発生します。

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>

このコード

「glassfish3/glassfish/modules/javax.faces.jar」ファイルに最新のJSFバージョンをコピーしました。

私は問題を理解していません。

24
Rhododendron

JSF 2.2のスキーマ名前空間が変更されました。 faces-config.xmlは次のようになります。

<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>
70
Michi

Eclipseでも同じ問題が発生しました。まだ警告が表示されます(「文法コストトレインはありません。」)しかし、アプリケーションは動作します。これは私のfaces-configファイルです:

<?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.properties(デフォルト)およびMessages_de.propertiesと呼ばれます。

1
Laura Liparulo

この問題の理由は、 http://Java.Sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd アドレスが無効であるためです。したがって、次の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://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