wood burning stoves*
The moose likes JSF and the fly likes Problems of Deploying JSF war file to Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problems of Deploying JSF war file to Tomcat" Watch "Problems of Deploying JSF war file to Tomcat" New topic
Author

Problems of Deploying JSF war file to Tomcat

Ranjith Kodikara
Greenhorn

Joined: Sep 03, 2002
Posts: 15
Hi,
I am a beginner in JSF. I created some web applications with JSF using Oracle JDeveloper. Thse are correctly running on JDeveloper's in-built oc4j. I deployed those applications on Tomcat and Jboss. Those are not working on non of those. I dont know the corrct url to be called for the web application running on tomcat or jboss. I tried my best according to the url's I tested on Oc4j.

I dont know whether it's possible to attch the war file with this forum. I have the WAR file with me, and it's correctly extracted in the webapps folder of the Tomcat 5.5.20. But in the Internet Explorer, it gives the HTTP Status 404 error message.

Any help will be greatly appreciated.

Thanks,
Ranjith Kodikara (SCJP,SCWCD)
ranjithk@lankaorix.com
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Hi,

List down your application's deployment descriptor here and also the URL you are trying to access?
Ranjith Kodikara
Greenhorn

Joined: Sep 03, 2002
Posts: 15
Thanks a lot for your reply. I will list all the files in my web app here because it is a very simple web app with a single jsp page and only one jsf backing bean.


The war file's name is jsfbean2, so the extracted folder name is also the same.

The URL's I tried are,

http://127.0.0.1:8080/jsfbean2/faces/Register.jsp
http://127.0.0.1:8080/jsfbean2/Register.jsp
http://127.0.0.1:8080/jsfbean2/Register.jsf
http://127.0.0.1:8080/jsfbean2/Register.faces
http://127.0.0.1:8080/jsfbean2/faces/Register
All those gives HTTP Status 404 Error...

INSIDE WEB-INF
My web.xml file:
<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app 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" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<description>Empty web.xml file for Web Application</description>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>



and my faces-config.xml file (INSIDE WEB-INF):
<?xml version="1.0" encoding="windows-1252"?>
<!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 xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>personData</managed-bean-name>
<managed-bean-class>proj1.PersonInfo</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>



In classes/proj1 folder PersonInfo.class
it's source code:

package proj1;

public class PersonInfo {
public PersonInfo() {
}

private String username;
private String email;

public void setUsername(String username) {
this.username = username;
}

public String getUsername() {
return username;
}

public void setEmail(String email) {
this.email = email;
}

public String getEmail() {
return email;
}

public void saveInfo (String name, String mail) {
System.out.println("saving..." + name + " " + mail);
}

public String commandButton_action() {
saveInfo (this.username, this.email);
return null;
}
}



Outside the WEB-INF folder, there is only one jsp file.
Register.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"/>
<title>Home Page</title>
<style type="text/css">
body {
background-color: #ffefd6;
}
</style>
</head>
<body><font size="4">
<font color="#0000ff">
<h:form>
<p>
<font face="Andale Sans" size="5" color="#ff9494">
<strong>Registration Form</strong>
</font>
</p>

<table cellspacing="2" cellpadding="3" border="1" width="100%">
<tr>
<td>
<font color="#ff8484">
User Name
</font></td>
<td>
<font color="#ff8484">
<h:inputText value="#{personData.username}"/>
</font>
</td>
</tr>
<tr>
<td>
<font color="#ff8484">
Email
</font></td>
<td>
<font color="#ff8484">
<h:inputText value="#{personData.email}"/>
</font>
</td>
</tr>
<tr>
<td>
<font color="#ff8484">
 
</font></td>
<td>
<font color="#ff8484">
<h:commandButton value="Sign Up !"
action="#{personData.commandButton_action}"/>
</font>
</td>
</tr>
</table>
<p>
 
</p>
</h:form>
</font>
</font></body>
</html>
</f:view>
<%--
oracle-jdev-comment referred-managed-bean-name ersonData
--%>

Thanks for your kind attention!

Ranjith Kodikara (SCJP,SCWCD)
ranjithk@lankaorix.com
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Put this in web.xml and check if it works



Now use http://localhost:8080/jsfbean2/Register.jsf to access the page
Ranjith Kodikara
Greenhorn

Joined: Sep 03, 2002
Posts: 15
Dear Ali,

I put the code you have posted in web.xml, but still it's not working at all. Still I get the same HTTP Status 404 - /jsfbean2/Register.jsf Error.

I deleted all stuff in tomcat works directory and checked, whether it's cached and then I cleared browser cache also.. But still the output is same ...

Any Idea please...

Thanks and best regards,
Ranjith odikara
ranjithk@lankaorix.com
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536

All those gives HTTP Status 404 Error...

it means that your application isn't started due to errors. have a look at the tomcat logs and find out the error message.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems of Deploying JSF war file to Tomcat