Tomcat错误:在ExternalContext中找不到资源 [英] Tomcat error: Not Found in ExternalContext as a Resource

查看:243
本文介绍了Tomcat错误:在ExternalContext中找不到资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过 http://localhost/home/index.html访问开发站点时,出现此错误. 重定向到 http://localhost/home/views/main/index.xhtml :

I got this error when I tried to access my development site via http://localhost/home/index.html which redirects to http://localhost/home/views/main/index.xhtml:

java.io.FileNotFoundException: /views/main/index*.xhtml Not Found in ExternalContext as a Resource

我正在将Tomcat 7.0.8和Mojarra JSF 2.0.4与Eclipse Helios结合使用.我已经检查了WAR部署文件中的index.xhtml文件,并且该文件位于WAR文件中.我还检查了../wtpwebapps/home/views/main目录,可以看到Eclipse已经部署了index.xhtml文件.

I'm using Tomcat 7.0.8, Mojarra JSF 2.0.4 with Eclipse Helios. I have checked the WAR deployment file for the index.xhtml file and it's there in the WAR file. I also checked the ../wtpwebapps/home/views/main directory and can see Eclipse has deployed the index.xhtml file.

我得到的堆栈跟踪是:

    07/02/2011 3:58:53 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/home] threw exception
java.lang.NullPointerException
    at com.sun.faces.lifecycle.RestoreViewPhase.notifyAfter(RestoreViewPhase.java:301)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:114)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

我不确定为什么会出现上述错误.有人可以帮忙吗?

I'm not sure why I am getting the above error. Can anyone help?

推荐答案

我解决了问题:这只是web.xml的配置问题.

I solved the problem: It was just a config issue with web.xml.

我在web.xml中将webapp版本声明为2.0,而对于Tomcat 7则声明为3.0.

I declared webapp version as 2.0 in web.xml instead of 3.0 for Tomcat 7.

这篇关于Tomcat错误:在ExternalContext中找不到资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆