问题
I have the following
String pattern = "\\b(" + StringUtils.join(mypattern, "|") + ")\\b";
and in pom.xml, I have dependency for
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
However when I execute, I am getting the following errors inspite of having commons-lang
java.lang.NoSuchMethodError:org.apache.commons.lang.StringUtils.join (Ljava/util/Collection;Ljava/lang/String;)Ljava/lang/String;
How can I resolve this issue?
Update 1
War contents
War structure
回答1:
- Review that the error is being throw in the line you posted (check the full stacktrace).
- Review that commons-lang.jar is inside the war (folder /WEB-INF/lib/) and is the same jar version that you expected.
- Review that there is no other commons-lang being loaded. For example, if you are deploying in Tomcat, check that there is no other commons-lang in tomcat/lib directory.
来源:https://stackoverflow.com/questions/28186267/despite-having-commons-lang-included-in-pom-getting-exception-java-lang-nosuchm