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.
Sample code:-
JSONObject json = new JSONObject();
String pair= "{long sting here}";//11586 letter count
json.accumulate("message", pair);
I have used following jar file:-
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)
noSuchMethodit's the sign you're using different or two libraries in classpath. So now to the point: At compile time check what library requires what jar. (If you use maven\gradle there're command to show graph tree). Then Compare then withRUNTIMElibs. You can see which lib requireS another one by exception stacktrace. To find the required lib you needYourClass.class.getClassloader.getResource('package.YourClass.class. So thus you will understand why this exception has occurred.