java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.isBlank(Ljava/lang/String;)Z 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41485563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.isBlank(Ljava/lang/String;)Z Error
提问by Thusitha Indunil
I have created WS02MB project. Inside that project I have used net.sf.json.JSONObject
, accumulate method above error occur. Please advise how to resolve this issue.
我已经创建了 WS02MB 项目。在我使用的那个项目中net.sf.json.JSONObject
,出现上述错误的累积方法。请告知如何解决此问题。
Sample code:-
示例代码:-
JSONObject json = new JSONObject();
String pair= "{long sting here}";//11586 letter count
json.accumulate("message", pair);
I have used following jar file:-
我使用了以下 jar 文件:-
andes-client-3.1.1.jar
commons-beanutils.jar
commons-collections-3.2.1.jar
commons-lang.jar
commons-lang3-3.5.jar
commons-logging-1.2.jar
ezmorph-1.0.6.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
json-lib-2.4-jdk15.jar
log4j-1.2.13.jar
org-apache-commons-codec.jar
org-apache-commons-logging.jar
org.eclipse.paho.client.mqttv3-1.0.2.jar
org.wso2.carbon.logging-4.4.1.jar
org.wso2.securevault-1.0.0-wso2v2.jar
Error Message:-
错误信息:-
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.isBlank(Ljava/lang/String;)Z
at org.apache.commons.lang.math.NumberUtils.createNumber(NumberUtils.java:500)
at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:417)
at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1008)
at net.sf.json.JSONObject._fromString(JSONObject.java:1201)
at net.sf.json.JSONObject.fromObject(JSONObject.java:165)
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:139)
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103)
at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:262)
at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
at net.sf.json.JSONObject._accumulate(JSONObject.java:2635)
at net.sf.json.JSONObject.accumulate(JSONObject.java:1543)
采纳答案by Thusitha Indunil
Finally I found the issue, This is due to commons-lang.jar and commons-lang3-3.5.jar conflict. So I have removed commons-lang.jar from Gradle task. Now it is working without any issue.
最后我找到了问题,这是由于 commons-lang.jar 和 commons-lang3-3.5.jar 冲突。所以我从 Gradle 任务中删除了 commons-lang.jar。现在它可以正常工作了。
回答by DaithiG
I got the same error with a Maven build. I accidentally imported commons.lang utility, when I should have imported commons.lang3. I would have thought this would be caught in the compile/build phase and not as a runtime exception.
我在 Maven 构建中遇到了同样的错误。我不小心导入了 commons.lang 实用程序,而我应该导入 commons.lang3。我原以为这会在编译/构建阶段被捕获,而不是作为运行时异常。