1.
如果你的程序无法正常运行,并且显示如下的错误:
严重: Exception starting filter struts2 Unable to load configuration. - bean –
jar:file:/F:/Struts2/Struts2/WebRoot/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424) ……
原因是由于有些文件的版本不匹配造成的,请将lib包中相关的commons组件包拷至项目之中并覆盖之即可。
主要是:commons-digester-x.jar,
commons-fileupload-x.jar,
commons-io-x.jar,
commons-lang-x.jar,
commons-logging-x.jar
2.
如果你的程序出现如下的错误信息
严重: 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:186)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
……
at java.lang.Thread.run(Unknown Source)
请确保你的struts2.xml放在classes下,亦即你的struts2.xml是否位于src目录之下。