wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts2 struck with a issue of 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 struck with a issue of 404" Watch "Struts2 struck with a issue of 404" New topic
Author

Struts2 struck with a issue of 404

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
MY index.jsp page




MY struts.xml file:



I am getting 404 eroor (I have my HelloStruts2World class in my hello package also)

type Status report

message /HelloStruts2World/HelloStruts2World

description The requested resource (/HelloStruts2World/HelloStruts2World) is not available.


I am able to display my index page , after submit i get the above one.
Please tell me is there anything i need to change anywhere.


If you want something you never had do something which you had never done
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you accessing the JSP page directly to get to the form? Have you verified the emitted HTML is correct? Can you access the action directly (i.e., not via form submission)?
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
I am using NetBeans as IDE . When i click Run on to the IDE:

This is the URL shown "http://localhost:8088/HelloStruts2World/" on the browser.

And i get the JSP page displayed

and also when i type http://localhost:8088/HelloStruts2World/index.jsp

the page will be shown.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you verified the emitted HTML is correct?

Accessing the JSP page directly will most likely *not* work; the S2 tags expect there to be a value stack available--I'm not sure that it would generate the appropriate HTML (but it might). It's generally best not to mix JSP/action access in a single application (and there's almost never a reason to anyway).
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
David Newton wrote: Can you access the action directly (i.e., not via form submission)?


How can i check this ??



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

Type in the URL of the action.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
David Newton wrote:...

Type in the URL of the action.


I tried that but same thing 404.

This is my whole index.jsp page:

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So...

- you're deploying to the "/HelloStruts2World" context
- /HelloStruts2World/index.jsp *does* show the JSP.
- /HelloStruts2World/HelloStruts2World.action does *not* work?

Are there any errors on startup? Do you have devMode turned on and logging turned up? What libraries are you deploying?

You could also try setting your package's "namespace" attribute to "/" just to eliminate another possible source of error.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
I already tried putting package names with

1. .

2. /

3. left it balnk also



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The other questions I asked were important too. Might as well include your web.xml too to make sure the filter is set up correctly.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
I extracted the war file created and checking everything . But for me everything seems okay.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I wrote: Are there any errors on startup? Do you have devMode turned on and logging turned up? What libraries are you deploying?

Which version of S2 are you using?
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
David Newton wrote:
I wrote: Are there any errors on startup? Do you have devMode turned on and logging turned up? What libraries are you deploying?


everthing is successful shown on IDE console , just checked server logs
I just checked everything on to server logs simply displaying




Which version of S2 are you using?


struts-2.0.14

I am using only 5 jar files commons-logging-1.0.4 , freemarker-2.3.8 , ognl-2.6.11 , struts2-core-2.0.14 , xwork-2.0.7
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I wrote:Are there any errors on startup? Do you have devMode turned on and logging turned up?
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
I just include <constant name="struts.devMode" value="true" /> this is struts.xml .But i don't know how this works .


Again nothing on server side logs.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You should probably configure logging to include debug information from Struts and XWork; it's odd to see *nothing* on startup.
Sam Tsang
Greenhorn

Joined: Mar 26, 2009
Posts: 5
I have the same issues many times when I first used struts 2. You need to check your struts.xml, make sure everything in this file is correct, for instance, action names, action classes, global results, interceptors, maybe you typed some action strings in your action class but forgot to refer them in struts.xml.
You can remove some parts in struts.xml to test which part goes wrong.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
where are your struts.xml located at?
is it in /WEB-INF/classes
 
 
subject: Struts2 struck with a issue of 404
 
Similar Threads
workflow problem
Request not able to reach Action class in Struts2
Struts 2.1 javascript field validate
problem in running the Struts2 program
web.xml and Struts 2