---
title: "Display tag报错问题，commons-lang-2.1，NoSuchMethodError"
author: "thousandzhang"
date: "2009-06-21T01:25:52Z"
tags: []
slug: "display-tag-commons-lang-2-1-nosuchmethoderror"
draft: false
lastmod: "2009-06-21T01:25:52Z"
id: 412199
url: "https://thousandzhang.iteye.com/blog/412199"
---

环境：eclipse3.3＋tomcat5.0.28

将examples工程在eclipse中搭建好后，由eclipse启动tomcat，这种方式会报2种错误：

**1、common-lang包不兼容错误：**

 

```
type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: 
You appear to have an INCOMPATIBLE VERSION of the commons-lang library. 
Displaytag requires version 2.1 of this library, and you appear to have a prior version in 
your classpath.  You must remove this prior version and ensure that only version 2.1 is in 
your classpath.
If commons-lang-x.jar is in your classpath, be sure to remove it. 
Be sure to delete all cached or temporary jar files from your application server; Tomcat 
users should be sure to also check the CATALINA_HOME/shared folder; you may need to 
restart the server. 
commons-lang-2.1.jar is available in the displaytag distribution, or from the commons-lang 
website at http://jakarta.apache.org/commons/lang 



	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
	org.apache.jsp.example_002dnocolumns_jsp._jspService(example_002dnocolumns_jsp.java:75)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


root cause 

javax.servlet.jsp.JspTagException: 
You appear to have an INCOMPATIBLE VERSION of the commons-lang library. 
Displaytag requires version 2.1 of this library, and you appear to have a prior version in 
your classpath.  You must remove this prior version and ensure that only version 2.1 is in 
your classpath.
If commons-lang-x.jar is in your classpath, be sure to remove it. 
Be sure to delete all cached or temporary jar files from your application server; Tomcat 
users should be sure to also check the CATALINA_HOME/shared folder; you may need to 
restart the server. 
commons-lang-2.1.jar is available in the displaytag distribution, or from the commons-lang 
website at http://jakarta.apache.org/commons/lang 



	org.displaytag.util.DependencyChecker.check(DependencyChecker.java:62)
	org.displaytag.tags.TableTag.doStartTag(TableTag.java:750)
	org.apache.jsp.example_002dnocolumns_jsp._jspx_meth_display_table_0(example_002dnocolumns_jsp.java:91)
	org.apache.jsp.example_002dnocolumns_jsp._jspService(example_002dnocolumns_jsp.java:58)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

```

 

 

**2、NoSuchMethodError错误：** 

 

```
javax.servlet.ServletException: org.apache.commons.lang.StringUtils.capitalize(Ljava/lang/String;)Ljava/lang/String;
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
	org.apache.jsp.example_002dconfig_jsp._jspService(example_002dconfig_jsp.java:127)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


root cause 

java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.capitalize(Ljava/lang/String;)Ljava/lang/String;
	org.displaytag.sample.ListObject.<init>(ListObject.java:106)
	org.displaytag.sample.TestList.<init>(TestList.java:92)
	org.apache.jsp.example_002dconfig_jsp._jspService(example_002dconfig_jsp.java:73)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

```

 但是用手动启动tomcat的方式这2个问题将不会出现错误，相当奇怪。试过把common-lang包的源文件加入工程，也不行。重新下载common-lang2.1或者2.3/2.4都不行。

**总之，不能在eclipse中启动tomcat的方式。**