java.lang.UnsupportedClassVersionError: (org/json/JSONObject) bad major version at offset=6

天大地大妈咪最大 提交于 2019-12-13 05:14:46

问题


In project i am using Websepear as server. After adding Json to my project i am getting below error.

---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)

Here is the Exception description .

 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] 

NOTE:- I built and run my project on java 6


回答1:


As your application is deployed on server, please check on which version of Java the server is running. I guess the Server is running on lower version of Java where as your project is built on Java-6.




回答2:


Try to increase the compilation level and use a compatible JRE



来源:https://stackoverflow.com/questions/25641993/java-lang-unsupportedclassversionerror-org-json-jsonobject-bad-major-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!