• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

404-tried everything

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you deploying the app to Tomcat?
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the sysdeo plugin to create the war file.
 
James McCluskey
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's basically the way it looks-just like you laid it out.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic