---
title: "struts2"
author: "tianhei"
date: "2011-06-21T14:56:52Z"
tags: ["Apache", "Struts", "freemarker", "log4j", "框架"]
categories: ["企业架构"]
slug: "struts2"
draft: false
lastmod: "2011-07-13T13:58:59Z"
id: 1099692
url: "https://tianhei.iteye.com/blog/1099692"
---

1、struts2.2.3最小jar包：  
struts2-core-2.2.3.jar ：Struts 2框架的核心类库  
xwork-core-2.2.3.jar ：XWork类库，Struts 2在其上构建  
commons-fileupload-1.2.2.jar ：文件上传组件，2.1.6版本后必须加入此文件  
commons-io-2.0.1.jar  
commons-lang-2.5.jar  
commons-logging-1.1.1.jar ：日志包，Struts 2框架使用这个日志包来支持Log4J和JDK 1.4+的日志记录。  
freemarker-2.3.16.jar ：Struts 2的UI标签的模板  
javassist-3.11.0.GA.jar ：唯一一个特殊的jar包，此包不在struts2的lib文件夹中。  
ognl-3.0.1.jar  ：对象图导航语言（Object Graph Navigation Language），struts2框架通过其读写对象的属性

2、如果struts2版本是2.1及以前

web.xml配置过滤器的时候应该是这样：  
&lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher&lt;/filter-class&gt; 

如果struts2 版本是2.1以上，web.xml配置：  
&lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;  

3、错误分析

java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils  
解决：缺少commons io包

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils  
解决：缺少commons lang包

java.lang.ClassNotFoundException: javassist.ClassPool  
解决：缺少javassist包