Struts2.3.16.3环境搭建需要导入的核心包:
1、commons-fileupload-1.3.1.jar:struts的上传下载 (不导入报异常struts2-core-2.3.16.3.jar!/struts-default.xml:64:179org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:501))
2、commons-io-2.2.jar:struts的上传下载
3、commons-lang3-3.1.jar:基础工具包,封装一些常用的基础操作,例如StringUtils类(不导入报异常java.lang.NoClassDefFoundError:org/apache/commons/lang3/StringUtilscom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211))
4、commons-logging-1.1.3.jar:Jakarta的通用日志记录包(不导入报异常 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
Unable to locate configuration files of thename struts-plugin.xml, skipping)
5、freemarker-2.3.19.jar:表现层框架,定义了struts2的可视主题(不导入报异常 struts2-core-2.3.16.3.jar!/struts-default.xml:69:87)
6、javassist-3.11.0.GA.jar:Javassist是用来操作字节码的(不导入报异常java.lang.reflect.InvocationTargetExceptionClass:com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector)
7、log4j-1.2.17.jar:日志输出组件(不导入报异常Unableto locate configuration files of the name struts-plugin.xml, skipping)
8、ognl-3.0.6.jar:支持ognl表达式(不导入报异常Java.lang.NoClassDefFoundError:ognl/PropertyAccessor atcom.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:333)
9、struts2-core-2.3.16.3.jar:struts2核心库(不导入抱异常:java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter)
10、xwork-core-2.3.16.3.jar:webwork核心库(不导入异常:java.lang.NoClassDefFoundError: com/opensymphony/xwork2/ActionContext)
异常:[SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SSHTest' did not find a matching property.
[SetPropertiesRule]警告的原因是Tomcat6.0的server.xml的context节点中不支持source属性,详细可以访问tomcat.apache.org,具体相关内容是:
For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the mainconf/server.xml
file cannot be reloaded without restarting Tomcat.
通关官网文档就可以轻松找到解决办法了。
这里通过修改Tomcat server配置(使用的是eclipse)。关闭server,然后在server视图中双击server,打开配置界面,选中下面的”Publish module contexts to separate XML files”,保存退出。