Java - JSON Object and ListOrderedMap problem
I am trying to use the JSON-lib api in my code to convert a java object into a JSONObject.
I have added all of the dependencies with the versions specified on the link below to my j2ee web module dependencies
http://json-lib.sourceforge.net/
However, whenever I call the JSONObject.fromObject() method I get NoSuchMethodError.
I should also point out that the exact same code and dependencies work on my tomcat server but do not work on my websphere application server. Does anybody know what I may be doing wrong ?
Partial stack trace below:
E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[SpringMVCServlet]: java.lang.NoSuchMethodError: org/apache/commons/collections/map/ListOrderedMap.<init>()V
at net.sf.json.JSONObject.<init>(JSONObject.java:1450)
at net.sf.json.util.CycleDetectionStrategy.<clinit>(CycleDetectionStrategy.java:37)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at net.sf.json.JsonConfig.<clinit>(JsonConfig.java:65)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.开发者_如何学编程initialize(J9VMInternals.java:200)
at net.sf.json.JSONObject.fromObject(JSONObject.java:134)
Make sure you have the correct version of commons collections jar in your WEB-INF/lib
and then set the "Classes loaded with application class loader first"
option in your WebSphere admin console as shown here
精彩评论