youssef youssef - 3 months ago 11x
Linux Question

can't change or add action in struts2

i am having a problem with struts i've been working with struts with more than 4 month now
the problem is when i add a new action i get this:

enter image description here

the previous actions work fine but when i modify the name of the action in struts.xml i get the error i mention above.
so for example i have the following code in struts.xml

<action name="test1" class="com.onda.beans.AfficheVolList">
<result name="success">table_vols_test_css.jsp</result>
<result name="fail">admin.jsp</result>

when i enter http://localhost:8080/Myproject/test1 it works fine
but after i change the name of the action

<action name="test2" class="com.onda.beans.AfficheVolList">
<result name="success">table_vols_test_css.jsp</result>
<result name="fail">admin.jsp</result>

and i try to enter localhost:8080/Myproject/test2
i got the error in the previous image it doesn't even take me to admin.jsp

i tried to clean the server and clean work directory but nothing work i even changed the server it works for the first time but after i change the name of the action it doesn't work
here is the log

`Jun 01, 2016 12:24:58 PM org.apache.struts2.dispatcher.Dispatcher error
SEVERE: Could not find action or result
There is no Action mapped for namespace [/] and action name [vols2] associated with context path [/Onda_vol]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(
at org.apache.struts2.impl.StrutsActionProxy.prepare(
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.AbstractHttp11Processor.process(
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
at org.apache.tomcat.util.threads.TaskThread$

thank you for taking time to answer my question i really appreciate it


This is probably a problem in your Apache Tomcat server configuration.

Your struts.xml looks perfectly fine and there is no reason changing the name would break the action.

Here's a few things you could consider doing and that might solve your problem:

  • Restart Tomcat

Depending on your linux distro and Tomcat version, this might differ.

sudo service tomcat7 restart
  • Restart your computer
  • Delete and reinstall Tomcat

I hope this helps.