Struts 2 Configuration Files Path

SHARE & COMMENT :

If you are a first time developer who start working on the Struts 2 application, you would have got the below exception and no clue how to fix this problem. This error is thrown because your struts 2 application not able to read your configuration file struts.xml. In any other frameworks we keep the configuration files under the WEB-INF folder which will be taken automatically.

But, in struts 2, by default the configuration file struts.xml is looked at WEB-INF/classes folder. It resolve this problem, copy the struts.xml file directly under the source folder like below screenshot. It is always should be inside the classpath of the project.

Struts 2 Project Structure

Struts 2 Project Structure

</pre>
Dec 12, 2013 11:57:48 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
WARNING: Could not find action or result
There is no Action mapped for namespace / and action name hello. - [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.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:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
 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:849)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
<pre>

Struts 2 Configuration Files Locations

Struts 2 Configuration Files Path

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better