我在学习ajax4jsf配置的时候,忘记在web.xml里配置ajax4jsf了,结果tomcat启动运行后,报错如下:
2008-11-7 15:41:43 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Resources framework is not initialised, check web.xml for Filter configuration
at org.ajax4jsf.framework.resource.ResourceBuilderImpl.getWebXml(ResourceBuilderImpl.java:107)
at org.ajax4jsf.framework.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:309)
at org.ajax4jsf.framework.resource.InternetResourceBase.getUri(InternetResourceBase.java:211)
at org.ajax4jsf.framework.resource.BaseResourceRenderer.encodeBegin(BaseResourceRenderer.java:62)
at org.ajax4jsf.framework.resource.OneTimeRenderer.encodeBegin(OneTimeRenderer.java:48)
at org.ajax4jsf.framework.resource.BaseResourceRenderer.encode(BaseResourceRenderer.java:45)
at org.ajax4jsf.framework.resource.InternetResourceBase.encode(InternetResourceBase.java:306)
at org.ajax4jsf.framework.resource.ClientScript.encode(ClientScript.java:143)
at org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase.encodeResourcesArray(HeaderResourcesRendererBase.java:131)
at org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase.preEncodeBegin(HeaderResourcesRendererBase.java:117)
at org.ajax4jsf.framework.renderer.RendererBase.encodeBegin(RendererBase.java:94)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
可是我修改web.xml后,netbeans里运行程序,tomcat启动日志里还是报错,错误和上面的一样,还是说web.xml配置有问题,但是程序运行没有错误。显然这个是tomcat误报。那么是甚么原因造成误报呢?经过整整1天的查找,发现是tomcat的日志问题。原来,在netbeans里运行程序,tomcat把日志保存在“C:/Documents and Settings/系统登录用户/.netbeans/6.1/apache-tomcat-6.0.16_base/logs”下,localhost.yyyy-MM-dd(yyyy-MM-dd为当天日期),tomcat运行的错误都保存在这里,如果第一次有有错误日志写在这里,以后在netbeans里运行项目,都会把这里的日志显示在netbeans的输出窗口的tomcat的日志里。找到地方后,就好办了,删除这里的日志,重新运行项目,一切ok,就不会再报错了。