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:
There is no Action mapped for namespace / and action name "yourActionName".
There is no Action mapped for namespace / and action name "yourActionName". - [unknown location]
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:
in your WEB-INF/classes/ file.


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" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
 	<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>

Assume the project root context is “Struts2Example“, so, you can access the above action via this URL –

Tags :
Founder of, 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.
My website is hosted by Liquid Web, I really like their fast and helpful support, it saved me a lot of time. Furthermore, their servers are extremely reliable, fast and stable, I don't remember when was the last time we had server downtime. Btw, they're offering $100 Coupon now, if you are sourcing for great hosting provider, go grab it.

Related Posts

Popular Posts