---
title: "Struts2的一个问题!Caused by: java.lang.NoClassDefFoundError: org/springframework/cont"
author: "asdcls"
date: "2009-12-31T00:16:08Z"
tags: []
categories: ["企业架构"]
slug: "struts2-caused-by-java-lang-noclassdeffounderror-org-springframework-cont"
draft: false
lastmod: "2009-12-31T00:17:53Z"
id: 560144
url: "https://asdcls.iteye.com/blog/560144"
---

关键字: struts2 
问题: 

Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware 

原因: 

Struts2的struts2-spring-plugin-2.0.11.jar等jar包需要使用ApplicationContextAware 去找Spring的 

Context,结果ApplicationContextAware类都找不到! 

解决方法(选择一种方法即可): 

方法1.在Struts2项目中只保留Struts2的5个必须的包,其他全部删除 

5个必须的包是: 
        commons-logging-1.0.4.jar 
        freemarker-2.3.8.jar         
        ognl-2.6.11.jar 
        struts2-core-2.0.11.1.jar 
        xwork-2.0.4.jar 

方法2: 

你的项目需要Spring的话,把Spring的包加进来也可以! 




摘自：http://blog.csdn.net/liuxiaotao008/archive/2008/07/18/2672200.aspx