我试图在代码中使用JSON-lib-api将java对象转换为JSONObject。
我已经将下面链接中指定版本的所有依赖项添加到我的j2ee web模块依赖项中
http://json-lib.sourceforge.net/
然而,每当我调用JSONObject.fromObject()方法时,我都会得到NoSuchMethodError。
我还应该指出,完全相同的代码和依赖项在我的tomcat服务器上工作,但在我的websphereapplicationserver上不工作。有人知道我做错了什么吗?
下面的部分堆栈跟踪:
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)