在我的项目中,我将Java EJB+Primefaces与Tomcat 7.11一起使用。编辑是NetBeans。我的项目运行良好,直到我意外地将一些.xhtml文件移动到另一个文件夹并保存。将文件移回正确的位置"MyProject\web\templates"后,现在,无论我做什么,Tomcat堆栈都会产生以下错误:
06-Apr-2020 15:35:17.522 SEVERE [http-nio-8080-exec-9] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Faces Servlet] in context with path [my/project]threw exception
java.io.FileNotFoundException: Facelet /templates/navbar.xhtml not found at: file:/C:/path/to/java/MyProject/build/web/templates/navbar.xhtml
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory._createFacelet(DefaultFaceletFactory.java:387)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.access$000(DefaultFaceletFactory.java:57)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:124)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:121)
at org.apache.myfaces.view.facelets.impl.FaceletCacheImpl.getFacelet(FaceletCacheImpl.java:84)
at org.apache.myfaces.view.facelets.impl.FaceletCacheImpl.getFacelet(FaceletCacheImpl.java:51)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:278)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:574)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:553)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:240)
at org.apache.myfaces.view.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:228)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:55)
at org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:374)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at org.apache.myfaces.view.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:195)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:59)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:521)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:575)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:553)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:240)
at org.apache.myfaces.view.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:151)
at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:59)
at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:189)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:477)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:78)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at ..
我的问题是,是什么导致了这种情况,为什么?
我已经通过删除NetBeans缓存解决了这个问题,但为什么会发生这种情况仍然是个谜。我试图通过做完全相同的事情来复制它(将一些.xhtml文件移动到不同的路径并保存(,但没有成功。
删除NetBeans缓存的最快方法是将以下命令应用于以ADMIN运行的CMD:
del /s /q %USERPROFILE%AppDataLocalNetBeansCache