Despite having commons-lang included in pom, getting exception java.lang.NoSuchMethodError:org.apache.commons.lang.StringUtils.join

房东的猫 提交于 2019-12-12 01:53:13

问题


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:


  1. Review that the error is being throw in the line you posted (check the full stacktrace).
  2. Review that commons-lang.jar is inside the war (folder /WEB-INF/lib/) and is the same jar version that you expected.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!