April 11, 2011

Struts 2 - There is no Action mapped for namespace / and action name

Exception:


There is no Action mapped for namespace / and action name Name. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)



Application Server: JBoss 4.2.2GA / Tomcat

Resolution:

Unlike Struts 1, where the struts configuration file (struts-config.xml) is put in the WEB-INF folder of the web application, in Struts 2, the struts configuration file (struts.xml) should be present in the base class directory (or the root of the application classpath), i.e., in the WEB-INF/classes directory of the Application Deployment.

The resolution is to add the struts.xml file in the src folder of the Web Application in Eclipse (in the default package) instead of in the WebContent/WEB-INF of the application project in Eclipse

No comments:

Post a Comment