在項目中,我使用Websepear作爲服務器。在將Json添加到我的項目後,我得到了錯誤。java.lang.UnsupportedClassVersionError:(org/json/JSONObject)在偏移量= 6的主要版本不佳
---Original exception---
java.lang.UnsupportedClassVersionError: (org/json/JSONObject) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:526)
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:477)
這是異常說明。
Caused by: java.lang.LinkageError: LinkageError while defining class: org.json.JSONObject
Could not be defined due to: (org/json/JSONObject) bad major version at offset=6
This is often caused by having a class defined at multiple
locations within the classloader hierarchy. Other potential causes
include compiling against an older or newer version of the class
that has an incompatible method signature.
Dumping the current context classloader hierarchy:
==> indicates defining classloader
==>[0]
注: - 我建立和Java 6的
由服務器提供的建庫什麼的Java版本? – Thomas 2014-09-03 10:30:21
@Thomas庫提供了Java6。 – Ajit 2014-09-03 10:31:20
另一個提示是由描述給出的:你是否檢查過在你的應用程序中(或者甚至在服務器中)只有一個包含這個類的jar? – Thomas 2014-09-03 10:32:20