Tomcat错误:在ExternalContext中找不到资源

当我尝试通过http://localhost/home/index.html访问开发站点时收到此错误,该站点重定向到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文件。

我得到的stacktrace是:

    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)

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

回答:

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

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

以上是 Tomcat错误:在ExternalContext中找不到资源 的全部内容, 来源链接: utcz.com/qa/404166.html

回到顶部