有时我会收到错误:
"javax.servlet.ServletException: Can not find bundle for messages based name, locale is"
我有一个带有 primefaces 的 JSF 应用程序,其中捆绑消息,几乎总是正常工作,除了 a 中的一种情况xhtml
,单击一个将数据保存在 a 中的按钮,有时有效,有时无效,具体取决于要包含或不包含对象 p 的图像:编辑。当它失败并出现以下错误时,好像找不到消息:
Estado HTTP 500 - Can't find bundle for base name messages, locale es
type Informe de Excepción
mensaje Can't find bundle for base name messages, locale es
descripción El servidor encontró un error interno que hizo que no pudiera rellenar este requerimiento.
excepción
javax.servlet.ServletException: Can't find bundle for base name messages, locale es
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
uned.lsi.security.SecurityFilter.doFilter(SecurityFilter.java:62)
causa raíz
java.util.MissingResourceException: Can't find bundle for base name messages, locale es
java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
java.util.ResourceBundle.getBundleImpl(Unknown Source)
java.util.ResourceBundle.getBundle(Unknown Source)
javax.faces.validator.MessageFactory.getMessage(MessageFactory.java:155)
javax.faces.validator.MessageFactory.getMessage(MessageFactory.java:245)
javax.faces.validator.LengthValidator.validate(LengthValidator.java:228)
javax.faces.component.UIInput.validateValue(UIInput.java:1142)
javax.faces.component.UIInput.validate(UIInput.java:960)
javax.faces.component.UIInput.executeValidate(UIInput.java:1204)
javax.faces.component.UIInput.processValidators(UIInput.java:693)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
javax.faces.component.UIForm.processValidators(UIForm.java:240)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
org.primefaces.component.panel.Panel.processValidators(Panel.java:293)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1159)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:72)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
uned.lsi.security.SecurityFilter.doFilter(SecurityFilter.java:62)
虽然它可能是 bounle 帖子的配置,因为它几乎总是像我一样离开这里:
faces-config
<application>
<message-bundle> messages </ message-bundle>
<locale-config>
<default-locale> is </ default-locale>
</ Locale-config>
<resource-bundle>
<base-name> MessageResources </ base-name>
<var> msg </ var>
</ Resource-bundle>
</Application>
xhtml
错误:
<f:loadBundle basename="MessageResources" var="msg"/>
MessageResources.properties
文件,src 目录。
在此先感谢,以防有人发生过类似的事情。