This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts doesn't want to work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts doesn Watch "Struts doesn New topic
Author

Struts doesn't want to work

Piotr Gorajski
Greenhorn

Joined: Jan 24, 2011
Posts: 3
Hi, I'm trying to build web application using Struts2 (2.2.1.1), Maven2 in Eclipse (Helios). I was trying to do it according to official tutorial:
http://struts.apache.org/2.x/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html
However for making maven app skeleton I used plugin from: http://m2eclipse.sonatype.org/installing-m2eclipse.html and created Maven Project.
In the result when I try to enter: http://localhost:8080/test_app/index.action, I'm getting HTTP Status 404 - /test_app/index.action.
Moreover, there are completly no logs apart from server starting in console :/ Not any struts logs :/

Below is my source code:

--log4j.xml--


--struts.xml--


--web.xml--


--pom.xml--


Folder structure of project:
http://img339.imageshack.us/i/navigatorfolderstructur.jpg

I'm running it on Tomcat 7.0
Please help, what am I doing wrong? I'm quite deseperate..

Thanks.
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

You may want to check your web.xml ... you have the filter and filter-mapping outside the web-app tag and you should not use FilterDispatcher as its been deprecated since 2.1.3 You should use probably use org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter instead.

But thats the only thing that jumps out at me
Piotr Gorajski
Greenhorn

Joined: Jan 24, 2011
Posts: 3
Thanks for pointing me these mistakes. After correction, my web.xml looks now like this:



Unfortunately, my problem still exists the same way it did before. Any further advices?
It seems like struts dispatcher is ommited.. I don't know why :/
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

then you should try turning on trace and you should verify what is actually being deployed to the tomcat server ...
Piotr Gorajski
Greenhorn

Joined: Jan 24, 2011
Posts: 3
Ok. By turning on trace, you mean debug? If yes then where should I place break points? And How can i check what is being actually deployed to the tomcat server? Honestly I've never done it.. And I've got a hunch, this is my deploying fault.
When I deploy my app for the first time, I rgiht click on project, New -> Server, and than add Tomcat. After this, I open added tomcat configuration and in Modules tab -> Add External Web Module, and from browse i set path to my app's target folder. Is it correct? Should I do this in another way? After this i start server in debug mode. The rest you already know..


EDIT: Ok, I've just figured it out Just like i thought, i deployed to tomcat the whole target folder instead of the one correct subfolder of it, with the name of my project Now it seems to work properly. Thanks very much for pointing these thigs.
Sahil Dave
Greenhorn

Joined: Nov 10, 2010
Posts: 11
I am facing a similar problem with the routing to index.action failing with a 404. However if i go to the context root of the app, it goes to index.jsp as expected.

web.xml


struts.xml


I am using Weblogic 9.2 as the application server and deploying the app as a war.
Please help.

Thanks


Sahil
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

Sahil Dave wrote:I am facing a similar problem with the routing to index.action failing with a 404. However if i go to the context root of the app, it goes to index.jsp as expected.


A Struts action cannot be configured as a "welcome file" without a workaround. Several are discussed here.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Sahil Dave
Greenhorn

Joined: Nov 10, 2010
Posts: 11
I created a new index.html and set it as the welcome file in web.xml

index.html


I pushed the index.jsp into a 'jsp' dir inside WebContent.

struts.xml


Now pointing to the context root takes me to index.html and consequently to index.action
But I am still getting a 404 instead of the jsp/index.jsp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts doesn't want to work
 
Similar Threads
Sonar - Native Plugin
Maven + Tiles + Struts2
Ear Building in Maven
Could not resolve dependencies for maven project
Maven: deploy application to server