There is no Action mapped for namespace / and action name “yourActionName”

Problem

Many Struts 2 developers are claimed that they had configured the action class properly but hits the actions error message while accessing the action class.

See error message in two modes :

1. “struts.devMode” is turn off (default)


HTTP Status 404 - 
There is no Action mapped for namespace / and action name "yourActionName".

type Status report 

message There is no Action mapped for namespace / and action name "yourActionName".

description The requested resource 
(There is no Action mapped for namespace / and action name "yourActionName".) is not available.

2. struts.devMode is turn on

In struts.xml


<constant name="struts.devMode" value="true" />

Struts Problem Report

Struts has detected an unhandled exception:

Messages:	
There is no Action mapped for namespace / and action name "yourActionName".
Stacktraces

There is no Action mapped for namespace / and action name "yourActionName". - [unknown location]
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
   ...
    
You are seeing this page because development mode is enabled. Development mode, or devMode, 
enables extra debugging behaviors and reports to assist developers. To disable this mode, set:

  struts.devMode=false
in your WEB-INF/classes/struts.properties file.

Solution

The above error message is saying that the action class is not available, it means you are did something wrong in your action class configuration, may be it’s a namespace or typo error, just double check the name.

Here’s a working action class configuration in struts.xml file, may use for your reference.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
 
<struts>
 	<constant name="struts.devMode" value="true" />
	<package name="default" namespace="/" extends="struts-default">
	
		<action name="abcAction" 
			class="com.mkyong.common.action.AbcAction" >
			<result name="success">pages/abc.jsp</result>
		</action>
		
	</package>
</struts>

Assume the project root context is “Struts2Example“, so, you can access the above action via this URL –
http://localhost:8080/Struts2Example/abcAction.action

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
sky
Guest
sky

sir , my project is run localhost but when upload linux server than give error

Not Found

The requested URL /welcomeLink.action was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

vikash
Guest
vikash

Hi yong,

i need to create chart using struts2 and display to jsp page.i could not find any example.can you help me on this.

Naveen
Guest
Naveen
org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler error SEVERE: Exception occurred during processing request: null java.lang.NullPointerException at org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69) at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) What is the error im not able to figure it out.
Aniruddha Das
Guest
Aniruddha Das

Add the below blank action to you struts.xml file in “/” package namespace and it will show the index.html when you will only try to access your url (like appid.app.com) and it will not show the error. Normally it will add a blank action and app engine will redirect the blank action to your welcome file.

index.jsp

adam
Guest
adam

shit dont work

Rajesh
Guest
Rajesh

HI Yong.! when i run the web application its not picking th welcome file automatically.

for example if i execut http://localhost:6035/HelpDesk/ its showing the followin error

there is no action mapped for namespace[/] and action name [] associated with context path [/HelpDesk]

but if i mentioned the .jsp explicitly its able to open the page like http://localhost:6035/HelpDesk/Login.jsp, i’m getting the login page.

this is my struts.xml

here is my web.xml

ETS

Login.jsp

struts2

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

struts2

/*

FORWARD

REQUEST

Please let me know where i’m doing wrong…. Thanks in Advance…

Shrenik
Guest
Shrenik

Hi Yong,

There is a merely difference in the above problem statement & in mine problem statement. I have an issue while i tried to access URL till namespace appears. lets say my namespace in struts.xml is

<package name="default" namespace="/helpdesk" extends="struts-default,json-default">

and somebody accesses URL like this

http://localhost:6035/HelpDesk/helpdesk/

. So what happens is it shows Struts Problem Report message as mentioned above. What could be the fix of this issue? Can we redirect user to login page or any other page when access of such URL? If yes then How? please explain.

Thanks & Regards

Shrenik

xnpeng
Guest
xnpeng

hi,Yong!
would you please help me with a struts2-rest-showcase.war problem in struts-2.3.4.1 app?
when i run the app,it gives out errors like the same thing above. because it is a rest-plugin,do not need action mapping defines in struts.xml. how to fix it? thank you.

Struts Problem Report
Struts has detected an unhandled exception:
Messages:
There is no Action mapped for namespace / and action name orders.
Stacktraces
There is no Action mapped for namespace / and action name orders. – [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:70)
org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:51)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)

Newbie
Guest
Newbie

I got the error message when used Struts 2.2.3 annotations, for Struts 2.1, it’s just fine.

strutsnewbie
Guest
strutsnewbie

Hi all

I tried all the possible ways given here but this doesnot seems to be helpful for me. I am using Eclipse EE, so can anyone tell where to put this struts.xml file.

Naveen
Guest
Naveen

u have to put the struts.xml with in src folder of ur dynamic web project.

Dhaval
Guest
Dhaval

Thanks. :)

prateek
Guest
prateek

HI,

The best way to put “struts.xml” in the resources folder. You can make the resources folder on the root.

Thanks,
Prateek

christopher
Guest
christopher

am tired of struts2 but it provided me right solution.I love this article.I recommend this article to my friends

trackback
Struts 2 Tutorials

[…] There is no Action mapped for namespace / and action name “yourActionName” […]

roland
Guest
roland

“There is no Action mapped for namespace / and action name “yourActionName”.”

Please note, that Struts 2 has a different place for the struts.XML file!
Under WEB-INF/classes instead of WEB-INF.

Thanx for that undocumented or darkly commented change :-).
The message you get is the one above, instead of the rather logical “cannot load struts.XML file. Is it in WEB-INF/classes?”

Pavan
Guest
Pavan

thanks a lot for your valuable key point.

Jojo
Guest
Jojo

This might be as simple as addiing a “/” infront of the action name as below.

  <a href="" > VEGGIE 

or

   

This could fix the “There is no Action mapped for namespace” error

Jojo
Guest
Jojo

This might be as simple as addiing a “/” infront of the action name as below.

Jojo
Guest
Jojo

action=”/fileUploadAction”
in your form

Amitav
Guest
Amitav

Thanx roland…. your point solved my problem….
Thanx alot.

Shiva
Guest
Shiva

Thanks Roland! I placed the struts.xml in the src folder and it started working fine!

Anil
Guest
Anil

Thank buddy..
nice article..