struts2 java.lang.ClassNotFoundException: org.apache.commons.lang.xwork.StringUtils

本文介绍了解决Struts2项目启动时遇到的java.lang.ClassNotFoundException错误的方法。该问题源于struts2-convention-plugin引用了已废弃的org.apache.commons.lang.xwork.StringUtils类。文章提供了解决方案,即升级到兼容的struts2-convention-plugin版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

struts2项目启动时报错:

java.lang.ClassNotFoundException:org.apache.commons.lang.xwork.StringUtils。

是因为struts2-convention-plugin-xxxxxx.jar 某个版本的SEOActionNameBuilder类引用了 org.apache.commons.lang.xwork.StringUtils;

此类存在于xwork-core-2.1.6.jar,更高的版本已经没有这个类了。

解决的方法是,使用高版本的struts2-convention-plugin-xxxxxx.jar,最好使用struts2 lib中配套的jar。