struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manickam-Periaswamy.Vign...@epamail.epa.gov
Subject Eclipse WTP/Tomcat/Struts 2 - 404 error
Date Fri, 06 Apr 2007 21:19:02 GMT
Hi all

This might sound off topic, but I had already posted this in Eclipse WTP 
newsgroup, but couldn't resolve it yet. So I thought someone here might 
have already faced this problem.

I configured Eclipse WTP for a struts-enabled web application. When I ran 
my application using "run on server" option, it gives a 404 error.

Below is my configuration:
Java - 1.4.2_13
Tomcat 5.5.23 with Java 1.4 compatible jars
Struts 2.0.6 with Java 1.4 compatible jars
Eclipse WTP 3.2.2

I created a new "dynamic web project" with Tomcat 5.5 as runtime, "r5sis" 
as "context root" and "WebContent" as "Content Directory". I copied the 
struts jars to the "WebContent/WEB-INF/lib" folder. The jsp files are 
placed in "WebContent/WEB-INF/jsp" folder.

Find below my struts.xml and web.xml

<?xml version="1.0" encoding="UTF-8"?>
<struts>
   <!-- Include Struts 2 default (from Struts 2 JAR). -->
   <include file="struts-default.xml"/>

   <!-- Configuration for the default package. -->
   <package name="default" extends="struts-default">

       <!-- Default interceptor stack. -->
       <action name="login" 
class="gov.epa.r5sis.struts.action.LoginAction" >
          <result name="success" 
type="dispatcher">/WEB-INF/jsp/welcome.jsp</result>
          <result name="error" 
type="redirect">/WEB-INF/jsp/login.jsp</result>
      </action>

      <action name="logout2" 
class="gov.epa.r5sis.struts.action.LoginAction" method="logout" >
          <result name="success" 
type="redirect">/WEB-INF/jsp/login.jsp</result>
      </action>

      <action name="logout" 
class="gov.epa.r5sis.struts.action.LogoutAction" >
          <result name="success" 
type="redirect">/WEB-INF/jsp/login.jsp</result>
      </action>

   </package>
</struts>


<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
   <display-name>r5test</display-name>
   <filter>
       <filter-name>struts</filter-name>
       
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
   </filter>
   <filter-mapping>
       <filter-name>struts</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
   <welcome-file-list>
       <welcome-file>jsp/login.jsp</welcome-file>
       <welcome-file>index.html</welcome-file>
       <welcome-file>index.htm</welcome-file>
       <welcome-file>default.html</welcome-file>
       <welcome-file>default.htm</welcome-file>
       <welcome-file>default.jsp</welcome-file>
   </welcome-file-list>
</web-app>


When I run the application by using "run on server" option, the tomcat 
server starts without a problem and opens the url "http://localhost
:8080/r5sis/" in the browser.

It gives a 404 error, saying "The requested resource (/r5sis/) is not 
available." "r5sis" is my project name. Also the project is placed only in 
the eclipse workspace and not in the "<tomcat dir>/webapps" folder. Even 
"localhost:8080/index.jsp" gives a 404 error. 

When I tried running Tomcat from the command prompt, it runs properly and 
"localhost:8080/index.jsp" works fine.So the Tomcat is not working fine 
inside Eclipse WTP. Please let me know what went wrong.

A member in eclipse mailing list suggest to place the welcome file in the 
"WebContent" folder and try. So I just created a "index.htm" file with 
just "Hello world!", in the "WebContent" folder and modified the web.xml 
as:

<welcome-file-list>
        <welcome-file>index.htm</welcome-file>
</welcome-file-list>

But still it is not working, please help!

Thanks
Vignesh


Vignesh Manickam Periaswamy
Web Application Developer Intern, Information Management Section
WPTD,   EPA Region 5         312-886-0887
email: Manickam-Periaswamy.Vignesh@epa.gov


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message