有時我得到的錯誤:javax.servlet.ServletException:找不到捆綁的基本名稱的消息,現場ES
"javax.servlet.ServletException: Can not find bundle for messages based name, locale is"
我有primefaces其中捆綁的消息,幾乎總是正確的工作除了JSF應用程序對於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目錄。
在此先感謝您,以防萬一有人發生類似情況。
在默認語言環境中,你把'是',是一個錯字?你只支持西班牙語嗎?你還應該指定類MessageResources的完整路徑(包名),例如:com.myapp.language.MessageResources另外:語言文件的擴展名是.properties嗎? – Damian 2013-05-01 11:13:45