IBM WAS Community Edition 8.5.5.0 java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version

IBM WAS Community Edition 8.5.5.0 java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version

我遇到一个问题,WAS 给了我一个例外:

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=test/xyz/abc/servlet/StartUp, offset=6

我查看了这个文件的编译版本,主要版本是51。根据我的研究51是Java 7.

WAS 安装了 SDK 7,编译代码并使用 JDK 7 构建 ear。但我仍然遇到此错误。看不出可能是什么问题。想法?

.class 文件的版本:

Classfile /C:/Workspaces/TESTEAR/TEST_compiled_withIBMSDK7/TEST-web/WEB-INF/classes/test/xyz/abc/servlet/StartUp.class
  Last modified Sep 29, 2015; size 3475 bytes
  MD5 checksum cae118ff68e60ac948b1ea68f9faae1a
  Compiled from "StartUp.java"
public class test.xyz.abc.servlet.StartUp extends javax.servlet.GenericServlet
  SourceFile: "StartUp.java"
  minor version: 0
  major version: 51
  flags: ACC_PUBLIC, ACC_SUPER

我已经在 IBM WAS 8.5.5.0 上安装了 IBM SDK 7,看起来安装成功了。

IBM 安装详细信息:

WVER0010I: Copyright (c) IBM Corporation 2002, 2012; All rights reserved.
WVER0012I: VersionInfo reporter version 1.15.1.48, dated 2/8/12

--------------------------------------------------------------------------------
IBM WebSphere Product Installation Status Report
--------------------------------------------------------------------------------

Report at date and time October 13, 2015 10:39:19 AM EDT

Installation
--------------------------------------------------------------------------------
Product Directory        C:\IBM\WebsphereAS
Version Directory        C:\IBM\WebsphereAS\properties\version
DTD Directory            C:\IBM\WebsphereAS\properties\version\dtd
Log Directory            C:\ProgramData\IBM\Installation Manager\logs

Product List
--------------------------------------------------------------------------------
IBMJAVA7                 installed
BASE                     installed

Installed Product
--------------------------------------------------------------------------------
Name                  IBM WebSphere SDK Java Technology Edition (Optional)
Version               7.0.9.10
ID                    IBMJAVA7
Build Level           cf071533.01
Build Date            8/20/15
Package               com.ibm.websphere.IBMJAVA.v70_7.0.9010.20150820_1342
Architecture          x86-64 (64 bit)
Installed Features    IBM WebSphere SDK for Java Technology Edition 7

Installed Product
--------------------------------------------------------------------------------
Name                  IBM WebSphere Application Server
Version               8.5.5.0
ID                    BASE
Build Level           gm1319.01
Build Date            5/14/13
Package               com.ibm.websphere.DEVELOPERS.v85_8.5.5000.20130514_1044
Architecture          x86-64 (64 bit)
Installed Features    IBM 64-bit WebSphere SDK for Java
                      WebSphere Application Server Full Profile
                      EJBDeploy tool for pre-EJB 3.0 modules
                      Embeddable EJB container
                      Sample applications
                      Stand-alone thin clients and resource adapters

--------------------------------------------------------------------------------

我能够解决这个问题。安装 IBM SDK 7 后,我没有更新 ApplicationServer 设置。我们需要将 JDK 7 更新为应用程序服务器上的默认值。您可以通过以下路径访问它:服务器 -> WebSphere 应用程序服务器 -> server1(或服务器名称)-> Java SDKs。它将显示图像,您将所需的 JDK 设置为默认值。