java.lang.NoClassDefFoundError: Lcom/opensymphony/xwork2/util/logging/Logger tomcat6 启动错误

时间:2023-01-19 22:03:49

用tomcat6启动时,出现下面的错误
java.lang.NoClassDefFoundError: Lcom/opensymphony/xwork2/util/logging/Logger;

Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.logging.Logger

 

原因是struts2的包和xwork的包的版本不同
我用的是
xwork-2.0.4.jar

struts2-core-2.1.8.1.jar

 

那么struts2-core-2.1.8.1.jar包下面的org.apache.struts2.dispatcher.FilterDispatcher类有一个log全局变量
private Logger log = LoggerFactory.getLogger(FilterDispatcher.class);

 

LoggerFactory是在
com.opensymphony.xwork2.util.logging.LoggerFactory;

而xwork-2.0.4.jar没有这个类,要下载xwork-2.1.2.jar以上的版本才Yui有这个logging包


下载网址是
http://www.opensymphony.com/xwork/download.action

 

把xwork-2.0.4.jar换为xwork-2.1.2.jar重新启动项目就ok了