JSF 包加载失败
目前,我的 JSF (1.2) 应用程序在 Servlet 引擎 (Tomcat 6.0.32) 启动期间产生以下故障......
java.util.MissingResourceException: Can't find bundle for base name javax.faces.Messages, locale de
java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
java.util.ResourceBundle.getBundleImpl(Unknown Source)
java.util.ResourceBundle.getBundle(Unknown Source)
com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:177)
com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:136)
com.sun.faces.util.MessageUtils.getExceptionMessageString(MessageUtils.java:351)
com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:187)
com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:230)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:69)
org.apache.el.parser.AstValue.getValue(AstValue.java:112)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)
javax.faces.component.ValueExpressionValueBindingAdapter.getValue(ValueExpressionValueBindingAdapter.java:70)
org.apache.myfaces.custom.aliasbean.Alias.computeEvaluatedExpression(Alias.java:113)
org.apache.myfaces.custom.aliasbean.Alias.make(Alias.java:137)
org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:357)
org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:342)
org.apache.myfaces.custom.aliasbean.AliasBeanTagHandler.applyNextHandler(AliasBeanTagHandler.java:90)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:274)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:159)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:19)
com.icesoft.faces.context.View$2$1.respond(View.java:48)
com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:201)
com.icesoft.faces.context.View$2.serve(View.java:77)
com.icesoft.faces.context.View.servePage(View.java:149)
com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:52)
com.icesoft.faces.webapp.http.common.ServerProxy.service(ServerProxy.java:11)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet$4.service(MainSessionBoundServlet.java:149)
com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:89)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
de.konsens.wwwkmv.security.KmvExceptionTranslationFilter.doFilter(KmvExceptionTranslationFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
我已在 faces-config.xml 文件中配置了消息包,
<application>
<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
<locale-config>
<default-locale>de</default-locale>
<supported-locale>de</supported-locale>
<supported-locale>de_DE</supported-locale>
</locale-config>
<message-bundle>Messages</message-bundle>
</application>
我已将属性文件放入 WEB -INF/classes/ 文件夹(Messages_de.properties、Messages_de_DE.properties),但我总是收到此消息....最神秘的事情是我只更改了应用程序的配置读取中的内容,但没有更改更改 faces-config.xml 或 jspx 文件中的内容。
Currently my JSF (1.2) application produces the following failure during the start of the Servlet Engine (Tomcat 6.0.32)....
java.util.MissingResourceException: Can't find bundle for base name javax.faces.Messages, locale de
java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
java.util.ResourceBundle.getBundleImpl(Unknown Source)
java.util.ResourceBundle.getBundle(Unknown Source)
com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:177)
com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:136)
com.sun.faces.util.MessageUtils.getExceptionMessageString(MessageUtils.java:351)
com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:187)
com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:230)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:69)
org.apache.el.parser.AstValue.getValue(AstValue.java:112)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)
javax.faces.component.ValueExpressionValueBindingAdapter.getValue(ValueExpressionValueBindingAdapter.java:70)
org.apache.myfaces.custom.aliasbean.Alias.computeEvaluatedExpression(Alias.java:113)
org.apache.myfaces.custom.aliasbean.Alias.make(Alias.java:137)
org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:357)
org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:342)
org.apache.myfaces.custom.aliasbean.AliasBeanTagHandler.applyNextHandler(AliasBeanTagHandler.java:90)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:274)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:159)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:19)
com.icesoft.faces.context.View$2$1.respond(View.java:48)
com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:201)
com.icesoft.faces.context.View$2.serve(View.java:77)
com.icesoft.faces.context.View.servePage(View.java:149)
com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:52)
com.icesoft.faces.webapp.http.common.ServerProxy.service(ServerProxy.java:11)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet$4.service(MainSessionBoundServlet.java:149)
com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:89)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
de.konsens.wwwkmv.security.KmvExceptionTranslationFilter.doFilter(KmvExceptionTranslationFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
I have configured a message bundle in the faces-config.xml file
<application>
<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
<locale-config>
<default-locale>de</default-locale>
<supported-locale>de</supported-locale>
<supported-locale>de_DE</supported-locale>
</locale-config>
<message-bundle>Messages</message-bundle>
</application>
I have put the property file into WEB-INF/classes/ folder (Messages_de.properties, Messages_de_DE.properties) but i always get this message....the most mysterious thing is that i only changed things in the configuration reading of the application but didn't change things in faces-config.xml or jspx files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我收到了同样的错误消息:
嗯,我正在使用 XPages(IBM 基于 JSF 的强大 RAD 工具),在我的例子中,这是因为系统想要显示一些字段验证错误消息,当我的
MessagesObject
失去焦点(或者甚至没有渲染)。我从问题的根源解决了它,因为错误是由于现场验证造成的。
事实上,我点击的图像通过部分刷新切换到其他动态内容。我选择了“不验证或更新数据”,因此跳过了字段验证。
I got the same error message :
Well, I'm using XPages (IBM's powerful RAD tool based on JSF) and in my case it was because the system wanted to show some field-validation error messages, when my
MessagesObject
was out of focus (or not even rendered).I solved it at the source of the problem, because the error was due to a field-validation.
In fact, I was clicking on an image that switched to other dynamic content, by a partial refresh. I selected "Do not validate or update data", so the field-validation was skipped.
这实际上是一个误导性的异常,也是旧版 JSF 1.2 版本错误报告中的一个错误。 真正的问题是找不到
。您提到您将
Messages_de.properties
和Messages_de_DE.properties
放在/WEB-INF/classes
文件夹中,这很好,但您应该 < em>还提供默认的Messages.properties
文件。它可以保持为空。另一个可能的原因是您实际上使用 IDE 进行开发,并且通过 IDE 导航器将其逐字放置在
/WEB-INF/classes
文件夹中。你不应该这样做。每当您构建和部署 WAR 时,这都会被覆盖。相反,您应该将.properties
文件放置在项目的源根目录中,所有 Java 包也都在那里。This is actually a misleading exception and a bug in error reporting of older JSF 1.2 versions. The real problem is that the
<message-bundle>
cannot be found.You mentioned that you placed
Messages_de.properties
andMessages_de_DE.properties
in/WEB-INF/classes
folder, which is fine, but you should also supply a defaultMessages.properties
file. It can be kept empty.Another possible cause is that you're actually developing using an IDE and that you placed it literally in the
/WEB-INF/classes
folder by the IDE navigator. You should not do this. This will be overriden whenever you build and deploy the WAR. Instead, you should place the.properties
files in the source root of the project, there where all your Java packages also are.