Struts 2 : There is no Action mapped for namespace [/]

Solution 1:

Renaming Struts.xml naming convention to struts.xml will work.

Solution 2:

The message from error clearly says that

no Action mapped for namespace [/] and action name [getTutorial] associated with context path [/Struts2Starter]

This means that action configuration is not available at runtime. Check out the config-browser plugin to debug configuration issues.

To map correctly url to the action two parameters are required: the action name and namespace.

Struts loads xml configuration on startup and it should know the location of the struts.xml. By default it's looking on classpath to find a file with known name like struts.xml. Then it parses document and creates a runtime configuration. This configuration is used to find appropriate configuration element for the action url. If no such element is found during request, the 404 error code is returned with the message: There is no Action mapped for namespace and action name.

Also this message contains a namespace and action names used to find the action config. Then you can check your configuration settings in struts.xml. Sometimes the action name and namespace, stored in ActionMapping point to the wrong action. These values are determined by the ActionMapper which could have different implementation, used by plugins.

There's also another setting that might affect this mapper and mapping, but the point is the same if you get this message then URL is used didn't map any action config in runtime configuration. If you can't realize which URL you should use, you might try config-browser plugin to see the list of URLs available to use.