【问题标题】:JSF : java.util.MissingResourceException: Can't find bundle for base : Only if context root is changedJSF:java.util.MissingResourceException:找不到基础包:仅在更改上下文根时
【发布时间】:2017-04-14 23:06:20
【问题描述】:

我已经阅读了很多关于 MissingResourceException 问题的帖子。 我正在使用 Primefaces 5.1.3 就我而言,我有错误:

java.util.MissingResourceException: Can't find bundle for base [...], locale 

在 face-config.xml 中:

 <message-bundle>message.erreur.MsgErreurPrimefaces</message-bundle>

在我的消息来源中:

战争被打包在 EAR 中。当我保留默认上下文根时它工作正常,但如果我更改上下文根,我会收到消息。

该文件存在于战争的 WEB-INF 文件夹中:

WEB-INF/classes/message/erreur/MsgErreurPrimefaces_fr_FR.properties

谢谢

【问题讨论】:

    标签: primefaces jsf-2 message-bundle


    【解决方案1】:

    我以前遇到过这种错误,我的问题已通过如下编辑得到纠正。首先,我建议您添加并测试 MsgErreurPrimefaces.properties 文件。

    <?xml version='1.0' encoding='UTF-8'?>
    <faces-config version="2.2"
                  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">
        <application>
            <resource-bundle>
                <base-name>message.erreur.MsgErreurPrimefaces</base-name>
                <var>myBundle</var>
            </resource-bundle>
        </application>
        <application>
            <message-bundle>message.erreur.MsgErreurPrimefaces</message-bundle>
            <locale-config>
                <default-locale>fr_FR</default-locale>
                <supported-locale>fr_FR</supported-locale>
                <supported-locale>en_US</supported-locale>
            </locale-config>
        </application>
    </faces-config>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 2011-03-03
      • 2012-03-19
      • 1970-01-01
      相关资源
      最近更新 更多