今天遇到一个 500 错误(java.lang.UnsupportedClassVersionError),属于来自服务器内部的错误。该 j2ee 程序在我的电脑上没问题,但在客户的服务器上却出现问题,而最近只升级过一个 jar 文件,而错误提示也与该文件有关,于是问题范围就缩小了。
分析发现客户服务器上的 jdk 是 jdk 1.7,而我的电脑上是 jdk 1.8,而新发布的 jar 是以 jdk 1.8 为编码,那么问题就在于此,于是重新以 jdk 1.7 为编码进行编译并部署。至此,问题解决。
当然,也可以升级客户的 jdk 版本至 1.8,也可以解决这个问题。
HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.UnsupportedClassVersionError: Class com.google.zxing.WriterException has unsupported major or minor version numbers, which are greater than those found in the Java Runtime Environment version 1.7.0_67
noteThe full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.
GlassFish Server Open Source Edition 4.1
Q群讨论:236201801