no Action mapped for namespace / and action name

问题异常如下:

警告: Could not find action or result
There is no Action mapped for namespace / and action name login. - [unknown location]
	at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
	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:458)
	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:595)


There is no Action mapped for namespace / and action name login. - [unknown location]

有经验的就知道,这个是因为没有找到映射的action 空间名或者 没有找到匹配的 action名。
出现这样的问题,一般是因为没有加载 配置文件引起的。

果然。在布署的工程目录classes下,没有找到 struts.xml。

一般而言,对于没有经验的程序员来说,习惯用于集成IDE。以为在IDE里面的文件,理所当然的会把各种文件布署在对应的目录下。但往往有些时候,它也偶尔会发发脾气,不听使唤的。^-^
在其他的时候,也会因为使用IDE造成这样或者那样的错误。所以还是要自己明白,整个运行流程。然后一步一步的去排查。

你可能感兴趣的:(java,apache,tomcat,struts,ide)