You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ma...@epamail.epa.gov on 2007/04/11 23:06:11 UTC

Eclipse WTP / Struts 2 - Not working!!

Hi all

This problem has been driving me crazy and I know that it should be a 
simple problem. I have already posted this in this mailing list, but a 
simply configuration issue is stopping my development work!! Please help.

There is a reason why I post this in the struts mailing list because a 
non-struts web application works fine with Eclipse WTP.

I have written the simplest struts-enabled HelloWorld application. It 
works fine if I deploy it directly to the Tomcat server. But I get a 404 
error while configuring it with Eclipse WTP.

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, "test" 
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.

The following is my folder structure:
+ WebContent
- + WEB-INF
   - + classes
      - struts.xml
   - + jsp
   - + lib
   - + src
   - web.xml

Following are my codes:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" 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>test</display-name>
 
        <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</
filter-class>
    </filter>
 
        <filter-mapping>
                <filter-name>struts2</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>
 
</web-app>

struts.xml

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
        <!-- Configuration for the default package. -->
        <package name="default" extends="struts-default">
                <action name="HelloWorld" class="gov.epa.r5sis.HelloWorld"
>
                        <result>/WEB-INF/jsp/HelloWorld.jsp</result>
                </action>
 
        </package>
</struts>

HelloWorld.java

package gov.epa.r5sis;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {

        private static final long serialVersionUID = 1L;
        public static final String MESSAGE = "Hello World! Struts is up 
and running ...";

    public String execute() throws Exception {
        setMessage(MESSAGE);
        return SUCCESS;
    }

    private String message;

    public void setMessage(String message){
        this.message = message;
    }

    public String getMessage() {
        return message;
    }
}

HelloWorld.jsp

<%@ page contentType="text/html; charset=iso-8859-1" language="java" 
import="java.sql.*" errorPage="" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <title>Hello World!</title>
</head>

<body>
<h2><s:property value="message" /></h2>

</body>
</html>

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/test/" in the browser. "http://localhost
:8080/test/HelloWorld.action" gives a 404 error. But the same application 
deployed directly in Tomcat, works fine!!

Please help.

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


Re: [OT] Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Martin Gainty <mg...@hotmail.com>.
suggest searching for "Struts2 Eclipse plugin" here is a place to start 
looking
http://cwiki.apache.org/WW/plugins.html
With either sitemesh or tiles plugin
You would have to
-find the missing class
-find the jar which contains the missing class
-from Eclipse Go to 'Java Build Path'
-add external library and select the jar you are currently missing

Martin--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Piero Sartini" <li...@pierosartini.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, April 12, 2007 2:00 PM
Subject: Re: [OT] Re: Eclipse WTP / Struts 2 - Not working!!


> If I do understand it right then your s2 app works when deploying the war
> manually to tomcat. But if you try to start within eclipse it does not 
> work?
>
> There _must_ be some configuration issue with WTP. I guess there are some
> libraries from s2 that are packaged in the war but are not included if you
> deploy your ide project-path.
>
> I am a netbeans user so I can not help you much, sorry.
>
> Piero
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Piero Sartini <li...@pierosartini.de>.
If I do understand it right then your s2 app works when deploying the war 
manually to tomcat. But if you try to start within eclipse it does not work?

There _must_ be some configuration issue with WTP. I guess there are some 
libraries from s2 that are packaged in the war but are not included if you 
deploy your ide project-path. 

I am a netbeans user so I can not help you much, sorry.

Piero

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Dave Newton <ne...@yahoo.com>.
--- Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> So  that means the deployment is proper right?

It means the deployment for the other web project is
right; I have no real way of knowing if it is for the
Struts project.

> But why I get this problem when I include struts?
> which works fine when I deploy it separately in 
> Tomcat.

This is why I believe it is an Eclipse/WTP deployment
problem: if it works when you deploy it manually then
the configuration files are most likely correct.

Even if they weren't and you requested an action that
wasn't mapped you'd get a Struts error page, not a
404.

So the requests you are making are not being handled
properly: either you're not requesting in the right
context, or it's not being deployed properly, etc.

Once you deploy from within Eclipse re-check the
actual directory it's being deployed to and see if
everything is where it should be.

d.



       
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Ma...@epamail.epa.gov.
Sorry, still I did not understand it quite well.

But my non-struts web project is working fine along with Eclipse WTP. So 
that means the deployment is proper right? I understand that I sound dumb 
here.

But why I get this problem when I include struts? which works fine when I 
deploy it separately in Tomcat.

Vignesh Manickam Periaswamy
Web Application Developer Intern, Information Management Section
WPTD,   EPA Region 5         312-886-0887




Dave Newton <ne...@yahoo.com> 
04/11/2007 04:51 PM
Please respond to
Struts Users Mailing List <us...@struts.apache.org>



To
Struts Users Mailing List <us...@struts.apache.org>
cc





Subject
[OT] Re: Eclipse WTP / Struts 2 - Not working!!



--- Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> Sorry, I do not understand what you mean by
> publishing project.

Did you add a project deployment for the Struts app
and deploy it? In other words, did you configur things
such that Eclipse/WTP knows things about your app,
where you're deploying it to etc.?

d.



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



[OT] Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Dave Newton <ne...@yahoo.com>.
--- Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> Sorry, I do not understand what you mean by
> publishing project.

Did you add a project deployment for the Struts app
and deploy it? In other words, did you configur things
such that Eclipse/WTP knows things about your app,
where you're deploying it to etc.?

d.



       
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Ma...@epamail.epa.gov.
Sorry, I do not understand what you mean by publishing project.

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





Adam Ruggles <a....@gmail.com> 
04/11/2007 04:35 PM
Please respond to
Struts Users Mailing List <us...@struts.apache.org>



To
Struts Users Mailing List <us...@struts.apache.org>
cc





Subject
Re: Eclipse WTP / Struts 2 - Not working!!



Did you publish your project before starting tomcat through eclipse?

Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> Hi all
>
> This problem has been driving me crazy and I know that it should be a 
> simple problem. I have already posted this in this mailing list, but a 
> simply configuration issue is stopping my development work!! Please 
help.
>
> There is a reason why I post this in the struts mailing list because a 
> non-struts web application works fine with Eclipse WTP.
>
> I have written the simplest struts-enabled HelloWorld application. It 
> works fine if I deploy it directly to the Tomcat server. But I get a 404 

> error while configuring it with Eclipse WTP.
>
> 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, "test" 

> 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.
>
> The following is my folder structure:
> + WebContent
> - + WEB-INF
>    - + classes
>       - struts.xml
>    - + jsp
>    - + lib
>    - + src
>    - web.xml
>
> Following are my codes:
>
> web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_9" 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>test</display-name>
> 
>         <filter>
>         <filter-name>struts2</filter-name>
>         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</
> filter-class>
>     </filter>
> 
>         <filter-mapping>
>                 <filter-name>struts2</filter-name>
>                 <url-pattern>/*</url-pattern>
>         </filter-mapping>
> 
> </web-app>
>
> struts.xml
>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>         <!-- Configuration for the default package. -->
>         <package name="default" extends="struts-default">
>                 <action name="HelloWorld" 
class="gov.epa.r5sis.HelloWorld"
> 
>                         <result>/WEB-INF/jsp/HelloWorld.jsp</result>
>                 </action>
> 
>         </package>
> </struts>
>
> HelloWorld.java
>
> package gov.epa.r5sis;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloWorld extends ActionSupport {
>
>         private static final long serialVersionUID = 1L;
>         public static final String MESSAGE = "Hello World! Struts is up 
> and running ...";
>
>     public String execute() throws Exception {
>         setMessage(MESSAGE);
>         return SUCCESS;
>     }
>
>     private String message;
>
>     public void setMessage(String message){
>         this.message = message;
>     }
>
>     public String getMessage() {
>         return message;
>     }
> }
>
> HelloWorld.jsp
>
> <%@ page contentType="text/html; charset=iso-8859-1" language="java" 
> import="java.sql.*" errorPage="" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" 
/>
>  <title>Hello World!</title>
> </head>
>
> <body>
> <h2><s:property value="message" /></h2>
>
> </body>
> </html>
>
> 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/test/" in the browser. "http://localhost
> :8080/test/HelloWorld.action" gives a 404 error. But the same 
application 
> deployed directly in Tomcat, works fine!!
>
> Please help.
>
> Thanks
> Vignesh Manickam Periaswamy
> Web Application Developer Intern, Information Management Section
> WPTD,   EPA Region 5         312-886-0887
> email: Manickam-Periaswamy.Vignesh@epa.gov
>
>
> 



Re: Eclipse WTP / Struts 2 - Not working!!

Posted by Adam Ruggles <a....@gmail.com>.
Did you publish your project before starting tomcat through eclipse?

Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> Hi all
>
> This problem has been driving me crazy and I know that it should be a 
> simple problem. I have already posted this in this mailing list, but a 
> simply configuration issue is stopping my development work!! Please help.
>
> There is a reason why I post this in the struts mailing list because a 
> non-struts web application works fine with Eclipse WTP.
>
> I have written the simplest struts-enabled HelloWorld application. It 
> works fine if I deploy it directly to the Tomcat server. But I get a 404 
> error while configuring it with Eclipse WTP.
>
> 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, "test" 
> 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.
>
> The following is my folder structure:
> + WebContent
> - + WEB-INF
>    - + classes
>       - struts.xml
>    - + jsp
>    - + lib
>    - + src
>    - web.xml
>
> Following are my codes:
>
> web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_9" 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>test</display-name>
>  
>         <filter>
>         <filter-name>struts2</filter-name>
>         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</
> filter-class>
>     </filter>
>  
>         <filter-mapping>
>                 <filter-name>struts2</filter-name>
>                 <url-pattern>/*</url-pattern>
>         </filter-mapping>
>  
> </web-app>
>
> struts.xml
>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>         <!-- Configuration for the default package. -->
>         <package name="default" extends="struts-default">
>                 <action name="HelloWorld" class="gov.epa.r5sis.HelloWorld"
>   
>                         <result>/WEB-INF/jsp/HelloWorld.jsp</result>
>                 </action>
>  
>         </package>
> </struts>
>
> HelloWorld.java
>
> package gov.epa.r5sis;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloWorld extends ActionSupport {
>
>         private static final long serialVersionUID = 1L;
>         public static final String MESSAGE = "Hello World! Struts is up 
> and running ...";
>
>     public String execute() throws Exception {
>         setMessage(MESSAGE);
>         return SUCCESS;
>     }
>
>     private String message;
>
>     public void setMessage(String message){
>         this.message = message;
>     }
>
>     public String getMessage() {
>         return message;
>     }
> }
>
> HelloWorld.jsp
>
> <%@ page contentType="text/html; charset=iso-8859-1" language="java" 
> import="java.sql.*" errorPage="" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>  <title>Hello World!</title>
> </head>
>
> <body>
> <h2><s:property value="message" /></h2>
>
> </body>
> </html>
>
> 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/test/" in the browser. "http://localhost
> :8080/test/HelloWorld.action" gives a 404 error. But the same application 
> deployed directly in Tomcat, works fine!!
>
> Please help.
>
> Thanks
> Vignesh Manickam Periaswamy
> Web Application Developer Intern, Information Management Section
> WPTD,   EPA Region 5         312-886-0887
> email: Manickam-Periaswamy.Vignesh@epa.gov
>
>
>