This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes 404-tried everything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "404-tried everything" Watch "404-tried everything" New topic
Author

404-tried everything

Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
Hey gang,

I've looked at other post on this and at the help section but I am still not able to get a simple example to work today. Can someone give me so help please?

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
</web-app>


and my faces-config
<?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 >
<managed-bean>
<managed-bean-name>UserBean</managed-bean-name>
<managed-bean-class>com.bean.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userName</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
<managed-property>
<property-name>password</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/Welcome.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Welcome.jsp</from-view-id>
</navigation-rule>
</faces-config>

and my folder structure...

App
/src
/com.prperties
/com.beans
/WebRoot
/META-INF
/WEB-INF
/faces-config.xml
/web.xml
/index.jsp
/welcome.jsp

I can't get the index.jsp to load. I start tomcat, go to the manager to try and launch it-I see App in there but that is when I get the 404 error. If I go starting to App/index.faces or /index.jsp I still get the error. If I go to App/WebRoot/index.jsp I get a 500 error-OK, that last part might not be important...

So what am I doing wrong here?

Thanks
James McCluskey
Greenhorn

Joined: Aug 23, 2007
Posts: 10
How are you deploying the app to Tomcat?
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
I am using the sysdeo plugin to create the war file.
James McCluskey
Greenhorn

Joined: Aug 23, 2007
Posts: 10
Could you show us the contents of your webapps directory once Tomcat has unpacked the war file?

If you have:

<tomcat_dir>/webapps/<app_name>/index.jsp

Your URL should be localhost:8080/app_name/index.faces
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
That's basically the way it looks-just like you laid it out.
Denise Smith
Ranch Hand

Joined: Jul 26, 2005
Posts: 36
Add to web.xml


<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

then make the request like this
http://localhost/applicationName/faces/fileName.jsp

of course substitute the appropriate names for your server/application/fileName


Surround yourself with learners...They will educate you!
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
Tried that as well but no luck. Could there be something else wrong such as in a setting. I tried doing the basic intro application and I still get the same problem. I go to the tomcat manager page and launch the app from there and still I get the 404 error, Why?
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
If you are using myfaces i Think you are missing this in your web.xml

<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

Hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 404-tried everything