Paul Hopton schrieb: > Hi, > > I'm quite new to jsf, but know my way around tomcat and the > servlet-api pretty well. I'm working on a relatively complicated > project with a few dependencies, but to be able to track down my > problem I have created a simple application based on the NumberGuess > tutorial. The problem seems to be a configuration problem, but I can't > see where the problem is. and basically the configuration runs on my > local machine but not the server. > > Basically If, in my web.xml I map *.jsf to facesServlet I can see > /guess.jsf but if i create a file /test/guess.jsf I get a 404 error. > by putting in a few logs I can see that while /guess.jsf is handled by > facesServlet, /test/guess.jsf is not. > > if I map *.jsf to a testServlet the request is handled irrespective, > so the problem is not with tomcat. > > I'm using Facelets, but have also (for testing purposes) used jsp as > the view technology, and the result is the same. > > I'm using faces-1.2.4 (after trying in 1.2.3) > > We are serving Tomcat 6.0.18 directly (without apache front-end) with > Java 1.6.0_07-b06 on a Gentoo 1.12.11.1 System. > > locally I'm running Tomcat 6.0.18 > Java 1.6.0_07-b03 on Ubuntu 8.04.1 > > To rule out file permissions being a problem I did a chmod -R 777 on > the directory > > Config files follow at end of mail > > I've spent almost 3 days tearing everything to pieces now, and can't > make any progress. > any help, suggestions, advice gratefully received > > many thanks > > Paul Hopton > > -------------------------------------------------------------------------------------------- > > /WEB-INF/faces-config.xml > -------------------------------------------------------------------------------------------- > > > <?xml version="1.0" encoding="UTF-8"?> > > <web-app version="2.4" > xmlns="http://java.sun.com/xml/ns/j2ee" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > > <!-- Use Documents Saved as *.xhtml --> <context-param> > <param-name>javax.faces.DEFAULT_SUFFIX</param-name> > <param-value>.xhtml</param-value> > </context-param> > > <!-- UTESTING RESOLVER --> <context-param> > <param-name>facelets.RESOURCE_RESOLVER</param-name> > <param-value>tutorial.DefaultPaulSolver</param-value> > </context-param> > > <!-- Special Debug Output for Development --> > <context-param> > <param-name>facelets.DEVELOPMENT</param-name> > <param-value>true</param-value> > </context-param> > <!-- Optional JSF-RI Parameters to Help Debug --> > <context-param> > <param-name>com.sun.faces.validateXml</param-name> > <param-value>true</param-value> > </context-param> > <context-param> > <param-name>com.sun.faces.verifyObjects</param-name> > <param-value>true</param-value> > </context-param> > <!-- Faces Servlet --> > <servlet> > <servlet-name>Faces Servlet</servlet-name> > <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> > <load-on-startup>1</load-on-startup> > </servlet> > <!-- Faces Servlet Mapping --> > <servlet-mapping> > <servlet-name>Faces Servlet</servlet-name> > <url-pattern>*.jsf</url-pattern> > </servlet-mapping> > </web-app> > > -------------------------------------------------------------------------------------------- > > /WEB-INF/faces-config.xml > -------------------------------------------------------------------------------------------- > > > <?xml version='1.0' encoding='UTF-8'?> > <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD > JavaServer Faces Config 1.1//EN" > "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> > > <faces-config> > <!-- from project setup --> > <application> > <view-handler> > com.sun.facelets.FaceletViewHandler > </view-handler> </application> > > <!-- our NumberBean we created before --> > <managed-bean> > <managed-bean-name>NumberBean</managed-bean-name> > <managed-bean-class>tutorial.NumberBean</managed-bean-class> > <managed-bean-scope>session</managed-bean-scope> > <managed-property> > <property-name>min</property-name> > <value>1</value> > </managed-property> > <managed-property> > <property-name>max</property-name> > <value>10</value> > </managed-property> > </managed-bean> > > <!-- going from guess.xhtml to response.xhtml --> > <navigation-rule> > <from-view-id>/guess.xhtml</from-view-id> > <navigation-case> > <from-outcome>success</from-outcome> > <to-view-id>/response.xhtml</to-view-id> > </navigation-case> > </navigation-rule> > > <!-- going from response.xhtml to guess.xhtml --> > <navigation-rule> > <from-view-id>/response.xhtml</from-view-id> > <navigation-case> > <from-outcome>success</from-outcome> > <to-view-id>/guess.xhtml</to-view-id> > </navigation-case> > </navigation-rule> > > </faces-config> > That's very weird. I don't know why you are having problems; that's a pretty standard setup. And as you say: <quote>basically the configuration runs on my local machine but not the server</quote>
You say: <quote>I map *.jsf to facesServlet I can see /guess.jsf but if i create a file /test/guess.jsf I get a 404 error</quote> I presume you meant to say that you create file "guess.xhtml", and can access it as "/guess.jsf", but that when you create file "test/guess.xhtml" you cannot access it as "/test/guess.jsf". The fact that the problem is only on the server would suggest file-access-permissions or some apache-httpd-frontend config issue, but you've already excluded these possibilities. All I could suggest is starting tomcat with debugging options, and putting a breakpoint in the FacesServletImpl class, and the FaceletViewHandler class. There is a facelets config option to tell it to only process certain urls (facelets.VIEW_MAPPINGS) but I can't see how that could be the cause of your problem. When not set, facelets handles all requests that the FacesServlet is mapped to. And even then, I can't think of a setting for this property that would match top-level pages but not pages in subdirs. Your server is linux; is your development system also linux (ie not using a case-insensitive filesystem like NTFS)? Regards, Simon -- -- Emails in "mixed" posting style will be ignored -- (http://en.wikipedia.org/wiki/Posting_style)

