写了一个非常简单的webwork入门项目,Login登录模块,出现了错误:
com.opensymphony.xwork.config.ConfigurationException: Error loading configuration file xwork.xml
with nested exception
com.opensymphony.xwork.config.ConfigurationException: Caught exception while loading file xwork.xml
with nested exception
java.lang.Exception: Could not open file xwork.xml
com.opensymphony.xwork.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:127)
com.opensymphony.xwork.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:85)
com.opensymphony.xwork.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:56)
com.opensymphony.xwork.DefaultActionProxyFactory.setupConfigIfActionIsCommand(DefaultActionProxyFactory.java:58)
com.opensymphony.xwork.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:43)
com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:270)
com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:237)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
错误的原因很明显:没有找到xwork.xml文件,虽然在项目的源文件中已经出现了xwork.xml,于是,上网
搜索一下,还是没有答案(呵呵,确实郁闷),发现需要把webwork.properties放入src目录下面.最后发现原来是运行文件出现错误,即Tomcat-WebApp-ProjectName--WebRoot-Web-INF-并没有xwork.xml,拷贝源文件,终于成功.以前写struts,Hibernate,Spring
比较依赖开发环境,现在终于吃亏了,呵呵,不过个人也有进步,记录之.
一个典型的webwork Web项目开发目录:
ProjectName
-----src
--------------com.jobs002.webwork.action
--------------webwork.properties
--WebRoot
---------------METE-INF
---------------Web-INF
-----web.xml
------lib
------------------webwork2.17.jar等包(需要把包拷贝到这个地方)
------------------xwork.xml
------------------index.jsp