java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0

在maven项目中引入百度富文本编辑器ueditor-1_4_2的过程中遇到几个问题,记录下来。

第一个问题:在maven库中无法像其他jar包一样引入ueditor-1.1.0.jar,解决办法:不引用它的jar包,直接拷入引用的源代码就行,是去ueditor的官网下载:ueditor_release_ueditor1_4_3_1-src.zip,解压之后:java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0_第1张图片

我用的是jsp,所以选择jsp-》lib,点开之后:java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0_第2张图片

然后分别在maven中引入四个jar包,最下面的jar包就不用引入了

再选择jsp--》src ,可以看到:java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0_第3张图片

将这些java文件创建一个ueditor包,拷贝进入,然后分别修改各java文件的package路径名,最后在找到ueditor1_4_2\jsp\controller.jsp 文件修改里面的引入类路径:把 import="com.baidu.ueditor.ActionEnter" 修改成 import="org.ccpit.ueditor.ActionEnter"   这样就不用再引用ueditorjar包了。

第二个问题:在引用json.jar 启动程序,在创建UE的时候后台提示:

严重: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0 (unable to load class org.json.JSONObject)] with root cause
java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0 (unable to load class org.json.JSONObject)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2961)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.ccpit.ueditor.ConfigManager.initEnv(ConfigManager.java:165)
at org.ccpit.ueditor.ConfigManager.(ConfigManager.java:52)
at org.ccpit.ueditor.ConfigManager.getInstance(ConfigManager.java:66)
at org.ccpit.ueditor.ActionEnter.(ActionEnter.java:34)

at org.apache.jsp.resource.ueditor1_005f4_005f2.jsp.controller_jsp._jspService(controller_jsp.java:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

这个文件是由于引用json的版本不对引起的,打开pom.xml文件 找到引入json包的配置位置


org.json
json
20150729

修改成:


org.json
json
20140107

最后问题解决!

你可能感兴趣的:(java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0)