java.lang.UnsupportedClassVersionError:(org / json / JSONObject)偏差= 6的坏主要版本

时间:2014-09-03 10:28:07

标签: java json unsupported-class-version

在项目中我使用Websepear作为服务器。将Json添加到我的项目后,我收到了以下错误。

---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上构建并运行我的项目

2 个答案:

答案 0 :(得分:0)

当您的应用程序部署在服务器上时,请检查服务器正在运行的Java版本。我猜服务器在较低版本的Java上运行,因为你的项目是在Java-6上构建的。

答案 1 :(得分:0)

尝试提高编译级别并使用兼容的JRE