3

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

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.

The stacktrace I got is:

    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?

ChuongPham
  • 4,761
  • 8
  • 43
  • 53

2 Answers2

1

I have no idea how your code which is responsible for the redirect look like, but

/views/main/index*.xhtml

definitely doesn't look right. What is that asterisk doing there? Fix the code accordingly that this asterisk isn't emitted in the view ID anymore.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I have searched my entire project for index*.html but nothing comes up. I don't have any id attribute set up so I don't know where JSF/Tomcat is getting it from. My redirection is quite simple, the code for it is:
    in a HTML file. Is there any other things I can check e.g. web.xml config declarations?
    – ChuongPham Feb 07 '11 at 15:06
1

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

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

jb.
  • 23,300
  • 18
  • 98
  • 136
ChuongPham
  • 4,761
  • 8
  • 43
  • 53
  • 1
    @BernardMarx: At the time, I declared `webapp` version as `2.0` in `web.xml` instead of `3.0` for Tomcat 7. I guess it was the result of a lack of sleep and too much caffeine! -:). Now, I'm using Glassfish 3.1 server. It would have been too much work to get Tomcat running properly especially if you're using EJB 3 and JPA 2 together with JSF 2. – ChuongPham Apr 13 '11 at 18:00
  • @BalusC: At the time, I declared webapp version as `2.0` in `web.xml` instead of `3.0` as I'm using Tomcat 7. Silly mistake, I guess. – ChuongPham Apr 22 '11 at 15:39