我想在我的代碼中使用JSON-lib api將java對象轉換爲JSONObject。Java - JSON對象和ListOrderedMap問題
我已經加入所有的依賴與該鏈接指定下面我的J2EE Web模塊依賴
http://json-lib.sourceforge.net/
但是,每當我打電話JSONObject.fromObject()方法,我得到的NoSuchMethodError版本。
我還應該指出我的tomcat服務器上有完全相同的代碼和依賴關係,但不能在我的websphere應用程序服務器上工作。有人知道我可能做錯了什麼嗎?
部分堆棧跟蹤如下:
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)
你有commons collection api的正確版本?使用反編譯器來確定你是否有一個。 – 2011-05-31 15:18:30