搭建Thrift项目时遇到的UnsupportedClassVersionError问题

问题一:?Internal error (java.lang.UnsupportedClassVersionError): com/intellij/plugins/thrift/jps/ModelSerializerExtension has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Internal error (java.lang.UnsupportedClassVersionError): com/intellij/plugins/thrift/jps/ModelSerializerExtension has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
java.lang.UnsupportedClassVersionError: com/intellij/plugins/thrift/jps/ModelSerializerExtension has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at com.intellij.util.containers.ContainerUtilRt.copy(ContainerUtilRt.java:113)
at com.intellij.util.containers.ContainerUtil.newArrayList(ContainerUtil.java:205)
at org.jetbrains.jps.service.impl.JpsServiceManagerImpl$SingleClassLoaderPluginManager.loadExtensions(JpsServiceManagerImpl.java:113)
at org.jetbrains.jps.service.impl.JpsServiceManagerImpl.loadExtensions(JpsServiceManagerImpl.java:105)
at org.jetbrains.jps.service.impl.JpsServiceManagerImpl.getExtensions(JpsServiceManagerImpl.java:58)
at org.jetbrains.jps.model.serialization.JpsModelSerializerExtension.getExtensions(JpsModelSerializerExtension.java:47)
at org.jetbrains.jps.model.serialization.library.JpsSdkTableSerializer.getSdkPropertiesSerializer(JpsSdkTableSerializer.java:126)
at org.jetbrains.jps.model.serialization.library.JpsSdkTableSerializer.loadSdk(JpsSdkTableSerializer.java:64)
at org.jetbrains.jps.model.serialization.library.JpsSdkTableSerializer.loadSdks(JpsSdkTableSerializer.java:56)
at org.jetbrains.jps.model.serialization.JpsGlobalLoader$SdkTableSerializer.loadExtension(JpsGlobalLoader.java:124)
at org.jetbrains.jps.model.serialization.JpsGlobalLoader$SdkTableSerializer.loadExtension(JpsGlobalLoader.java:117)
at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadComponents(JpsLoaderBase.java:46)
at org.jetbrains.jps.model.serialization.JpsGlobalLoader.loadGlobalComponents(JpsGlobalLoader.java:80)
at org.jetbrains.jps.model.serialization.JpsGlobalLoader.load(JpsGlobalLoader.java:70)
at org.jetbrains.jps.model.serialization.JpsGlobalLoader.loadGlobalSettings(JpsGlobalLoader.java:43)
at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:21)
at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:34)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:64)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:279)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

  

解决方法:

禁用Thrift Support 1.4.0插件,服务器就能成功运行

搭建Thrift项目时遇到的UnsupportedClassVersionError问题

 

 

但是我不知道为什么这样就能成功运行的具体原因。这样就造成了一个麻烦事情,写的时候需要用到Thrift Support插件,运行的时候又要将插件禁用。

-----------------------------------------------------------?

根据大佬的建议,导致原因可能是Thrift Support1.4.0和Java8不太兼容,因此解决办法是升级Thrift Support的版本。但是注意Thrift Support的版本是和idea的版本一一匹配的,因此可能会造成无法更新插件的问题。如下

搭建Thrift项目时遇到的UnsupportedClassVersionError问题

 

 

这种情况就需要先更新idea的版本。

具体更新步骤如下。点击 help-Check for Updates
会一键更新idea的版本和插件版本

搭建Thrift项目时遇到的UnsupportedClassVersionError问题

 

 我的idea版本更新后如下,Thrift Support插件也更新到1.8.0.完美解决问题

搭建Thrift项目时遇到的UnsupportedClassVersionError问题

 

搭建Thrift项目时遇到的UnsupportedClassVersionError问题

上一篇:性能测试


下一篇:携程Apollo配置中心介绍以及实现细节