发出Eclipse找不到ExternalContext作为资源

时间:2018-12-06 10:53:17

标签: java eclipse java-ee tomcat8

我不得不从IntelliJ切换到Eclipse(Luna版本),并且不得不将旧的projet从Java 1.6升级到1.8,还添加了Maven以处理依赖项... 当我在Tomcat(8.0.53)下的IntelliJ上运行项目时,我一点都没有问题。一切工作顺利。 当我从Eclipse启动应用程序时...我面临着这个问题:

  

严重:异常处理ErrorPage [errorCode = 500,location = / error500.faces]   java.io.FileNotFoundException:/myProject/pages/template_nobuttons.xhtml在ExternalContext中找不到作为资源       在org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:300)       在org.apache.myfaces.view.facelets.impl.DefaultFacelet.getRelativePath(DefaultFacelet.java:468)       在org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:550)       在org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:240)       在org.apache.myfaces.view.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:150)       在org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:59)       在org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)       在org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:187)       在org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:483)       在org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:79)       在org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:266)       在javax.faces.webapp.FacesServlet.service(FacesServlet.java:206)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)       在org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:716)       在org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)       在org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)       在org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)       在org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)       在org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)       在org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:396)       在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:176)       在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)       在org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)       在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)       在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)       在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)       在org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:684)       在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1539)       在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1495)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)       在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)       在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)       在java.lang.Thread.run(Thread.java:748)

我并不是特别熟悉Eclipse,并且在做一些研究之后我已经尝试了几种方法。但是似乎什么都没有起作用... snifff:(

当我从Eclipse创建WAR文件并从部署了ROOT.war的tomcat实例手动运行它时,这真是太奇怪了……一切都在顺利进行。

因此,我认为当我从Eclipse启动Tomcat服务器时,它应该是Eclipse配置中的东西。

这是我的WebContent文件夹的屏幕 WebContent

我已经将其放在我的web.xml中

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

1 个答案:

答案 0 :(得分:0)

您是否尝试过以maven目标“干净安装”来重建项目,以我的经验,这样的错误通常在重建后就会消失。