File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts + Tomcat 6 + HelloWorld = Pain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts + Tomcat 6 + HelloWorld = Pain" Watch "Struts + Tomcat 6 + HelloWorld = Pain" New topic

Struts + Tomcat 6 + HelloWorld = Pain

Giovanni Varesotti

Joined: Feb 22, 2010
Posts: 5
Hi everyone,

I'm trying to setup a simple application using the above technologies. I'm actually following this tutorial:
I searched and read many topics on this subject still I cant find a solution that works for me.

I created this directory: $CATALINA_BASE/webapps/HelloWorld with this structure:
../WEB-INF/classes/tutorial/ and HelloWorld.class
../WEB-INF/lib/ -> filled with all the libs needed.

(HelloWorld.jsp, struts.xml and web.xml are just copy/paste from the same files I found in the tutorial above)

I fired up Tomcat and I deployed the application using the tomcat manager and I get this message: "OK - Started application at context path /HelloWorld" but browsing localhost:8080/HelloWorld leads to this error: HTTP Status 404 - There is no Action mapped for namespace / and action name .

As I said I looked inside the tomcat logs and on many many forums still I dont have a clue. :O

Any hints?


Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Fadeh: Welcome to Java Ranch!

It sounds like you don't have a welcome page identified for your web application.

You've created a web application named "HelloWorld" (based on the name of the directory you created under "webapps".
When you browse to localhost:8080/HelloWorld, this is accessing the root of your web application, not the JSP page you have in the root of your web application. What happens when you try browsing to localhost:8080/HelloWorld/HelloWorld.jsp?

Otherwise, perhaps you could show the contents of your web.xml file (please use code tags for that).

Best Regards,
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

"fedah fedaha", please check your private messages for an important administrative matter.

[Asking smart questions] [About Bear] [Books by Bear]
Giovanni Varesotti

Joined: Feb 22, 2010
Posts: 5
Thank you for your answer Mark.

You're totally right, if I try to access /HelloWorld/HelloWorld.jsp I get rid of that error. Adding a <welcome-file-list> into web.xml should solve the problem (forgot this step after an entire day of fails using netbeans)
Anyway another problem has arisen: the browser returns a blank page (the title is setted properly, afterall).

Here's the code:




Thank you,

David Newton

Joined: Sep 29, 2008
Posts: 12617

If the context is HelloWorld, and the action name is HelloWorld, then the appropriate URL would be /HelloWorld/HelloWorld.
Giovanni Varesotti

Joined: Feb 22, 2010
Posts: 5

Lamest thread award.

Thank you Dave, it works. I would like to say that I got lot of problems with NetBeans+Struts2 in the first place and after a day of fails I tried to build the project manually and this thread actually show how I was tired

Anyway, thanks to your answers, looks like I've solved the problem even with NetBeans.. in fact the first problem was I placed struts.xml in the wrong dir (it should be under the default package) and the second arise when you run the project, NetBeans automatically opens a wrong url (localhost:8080/HelloWorld withouth the action part).

Thank you again and sorry for the lame question.

David Newton

Joined: Sep 29, 2008
Posts: 12617

We've all been there :)
Tejeswar Peetha

Joined: Mar 26, 2006
Posts: 5

I am also facing the same problem. I have tried different alternatives but failed to resolve
I am getting the welcome page and initPersonAction is working properly... but, when I try to invoke other actions it is giving me the problem:

2010-10-25 18:17:09,814 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Could not find action or result>
There is no Action mapped for namespace / and action name addPersonAction!add. - [unknown location]

I am trying to access one Action class with different action names and method names.

Please suggest me

my struts.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "">


<constant name="struts.objectFactory" value="spring" />
<constant name="struts.devMode" value="false" />
<constant name="struts.enable.DynamicMethodInvocation" value="false" />

<package name="default" extends="struts-default">

<!-- Login Action -->
<action name="login" class="com.atos.referentiel.action.LoginAction">
<result name="SUCCESS">/WEB-INF/jsp/referentiel_home.jsp</result>
<result name="FAILURE">/WEB-INF/jsp/login_error.jsp</result>

<!-- Person Action -->

<action name="addPersonAction1" method="addPerson" class="com.atos.referentiel.action.PersonAction">
<result name="success">/WEB-INF/jsp/person/personMaster.jsp</result>

<action name="searchPersonAction" method="search" class="com.atos.referentiel.action.PersonAction">
<result name="success">/WEB-INF/jsp/person/personMaster.jsp</result>

<action name="initPersonAction" method="init" class="com.atos.referentiel.action.PersonAction">
<result name="success">/WEB-INF/jsp/person/personMaster.jsp</result>

<action name="addPersonAction" method="add" class="com.atos.referentiel.action.PersonAction">
<result name="input">/WEB-INF/jsp/person/addPerson.jsp</result>

<action name="loginError">


Tejeswar. P
I agree. Here's the link:
subject: Struts + Tomcat 6 + HelloWorld = Pain
It's not a secret anymore!