用spring2.5+struts2+ibatis2搭建了一个系统,本来只想做个小测试的。谁知道,一运行就抛错:
2009-5-27 17:09:03 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/E:/app/eclipse-tomcat-6.0.18/webapps/book/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:51:89
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
Caused by: Unable to load bean: type: class:org.apache.struts2.views.freemarker.FreemarkerManager - bean - jar:file:/E:/app/eclipse-tomcat-6.0.18/webapps/book/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:51:89
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 30 more
Caused by: java.lang.NoClassDefFoundError: freemarker/template/SimpleHash
2009-5-27 17:09:03 org.apache.catalina.core.StandardContext start
严重: Error filterStart
怎么会冒出个freemarker啊?真奇怪,我没有用到它啊。
没办法,只好找来freemarker-2.3.13.jar加入之后,没有报错了。^_^
很多人都是因为jar缺少或者多余造成了系统的出错。正常使用struts2.1.6,至少需要如下6 个jar包:
struts2-core-2.1.6.jar
freemarker-2.3.13.jar
commons-logging-1.0.4.jar
ognl-2.6.11.jar
xwork-2.1.2.jar
commons-fileupload-1.2.1.jar
还有时候会有莫名其妙的报错。有时候重新建立一遍工程就好了。
希望对大家有帮助。