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 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte 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 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte" Watch "Struts 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte" New topic
Author

Struts 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte

Sunny Kumar Kalra
Greenhorn

Joined: Oct 10, 2010
Posts: 15
Hi All,

I am facing issue of

There is no Action mapped for namespace [/] and action name [login] associated with context path [/StrutsAndHibernate]. - [unknown location]

In Struts.xml
--------------
<package name="default" extends="struts-default" namespace="/">
<action name="login" class="net.neo.sb.LoginAction"
method="checkLogin">
<result name="success">jsp/Welcome.jsp</result>
<result name="error">jsp/index.jsp</result>
</action>
</package>

In Index.jsp
----------------
<s:form name="frmLogin" action="login">
<s:textfield id="username" name="userName" label="User Name"></s:textfield>
<s:password name="password" label="Password"></s:password>
<s:submit align="center"></s:submit>
</s:form>

In Web.xml
--------------
<display-name>HelloWorldStruts</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
<!-- org.apache.struts2.dispatcher.FilterDispatcher-->
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>jsp/index.jsp</welcome-file>
</welcome-file-list>
</web-app>


So i am able to launch initial index.jsp, but when I try to submit on index.jsp I get following exception :

There is no Action mapped for namespace [/] and action name [login] associated with context path [/StrutsAndHibernate]. - [unknown location]
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:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

I know its something associated with namespace mapping because if I keep index.jsp and welcome.jsp directly in WebContent folder and make changes accordingly in welcome-file-list then it works.

Please help me to resolve the issue



[DirectoryStructure.png]

Yogesh Lonkar
Ranch Hand

Joined: Jul 17, 2012
Posts: 94

Suggestion please use Code tag while posting code
and as far the your problem it can be because of many reasons such as
1. You are missing some necessary .jar file inside you lib folder
2. You have conflicting jar files inside your lib folder such as struts2-core-2.1.6 and struts2-core-2.1.8.1 in this case only 1 out of 2 should exist
3. your struts.devMode is turned OFF by default which you can turn ON by using this line inside your struts.xml
4. and probably your web.xml is configured wrong it should contain

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


Learning some thing New Every Day
 
Don't get me started about those stupid light bulbs.
 
subject: Struts 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte
 
Similar Threads
unknown error while running Struts2 application
problem in Struts2 while running an application
Struts2 newbee - Problem when using form tag
Struts2 parameters is coming null in action class