不支持的类版本错误:WebSphere AS 7 中的 JVMCFRE003 主要版本不正确

2022-09-01 02:33:23

我收到此错误

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;类=地图/关怀月,偏移量=6

我的 Eclipse 的 Java 编译器设置为 C:\Program Files 中安装了 Java SDK,但是当我将应用程序安装到 Webshere Application Server V7 时,我仍然收到此错误。1.61.6.0

这是什么意思?我想使用Java 6进行编译,而Websphere 7支持Java 6。offset=6

我确实看到安装服务器的IBM目录中的JDK是Java 7。这是造成这种情况的原因吗?....但是我的工作区的 Eclipse 编译器再次设置为 Java 。1.6


答案 1

WebSphere Application Server V7 确实支持 Java Platform, Standard Edition (Java SE) 6(参见 Network Deployment(All Operating Systems), V7.0 Information Center 中的规范和 API 文档),并且自 V8.5 发行版以来,Java 7 一直受支持

我找不到 Java 6 SDK 文档,只能查阅 Java 7 Windows 文档中IBM JVM Messages。唉,我也无法在文档中找到错误消息。

由于 java.lang.UnsupportedClassVersionError“当 Java 虚拟机尝试读取类文件并确定文件中的主要和次要版本号不受支持时抛出”,因此您遇到了使用比运行时环境(即 WebSphere Application Server 7.0)支持的 Java 版本更新的 Java 版本构建应用程序的问题。

我可能弄错了,但我认为消息中的 offset=6 是为了让您知道是什么位置导致了不兼容问题的发生。这对你、对我和许多其他人来说都是无关紧要的,但有些人可能会发现它很有用,特别是当他们自己生成字节码时。

运行 versionInfo 命令以了解有关 WebSphere Application Server V7 的已安装功能,例如

C:\IBM\WebSphere\AppServer>.\bin\versionInfo.bat
WVER0010I: Copyright (c) IBM Corporation 2002, 2005, 2008; All rights reserved.
WVER0012I: VersionInfo reporter version 1.15.1.47, dated 10/18/11

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

Report at date and time February 19, 2013 8:07:20 AM EST

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

Product List
--------------------------------------------------------------------------------
BPMPC                    installed
ND                       installed
WBM                      installed

Installed Product
--------------------------------------------------------------------------------
Name                  IBM Business Process Manager Advanced V8.0
Version               8.0.1.0
ID                    BPMPC
Build Level           20121102-1733
Build Date            11/2/12
Package               com.ibm.bpm.ADV.V80_8.0.1000.20121102_2136
Architecture          x86-64 (64 bit)
Installed Features    Non-production
                      Business Process Manager Advanced - Client (always installed)
Optional Languages    German
                      Russian
                      Korean
                      Brazilian Portuguese
                      Italian
                      French
                      Hungarian
                      Simplified Chinese
                      Spanish
                      Czech
                      Traditional Chinese
                      Japanese
                      Polish
                      Romanian

Installed Product
--------------------------------------------------------------------------------
Name                  IBM WebSphere Application Server Network Deployment
Version               8.0.0.5
ID                    ND
Build Level           cf051243.01
Build Date            10/22/12
Package               com.ibm.websphere.ND.v80_8.0.5.20121022_1902
Architecture          x86-64 (64 bit)
Installed Features    IBM 64-bit SDK for Java, Version 6
                      EJBDeploy tool for pre-EJB 3.0 modules
                      Embeddable EJB container
                      Sample applications
                      Stand-alone thin clients and resource adapters
Optional Languages    German
                      Russian
                      Korean
                      Brazilian Portuguese
                      Italian
                      French
                      Hungarian
                      Simplified Chinese
                      Spanish
                      Czech
                      Traditional Chinese
                      Japanese
                      Polish
                      Romanian

Installed Product
--------------------------------------------------------------------------------
Name                  IBM Business Monitor
Version               8.0.1.0
ID                    WBM
Build Level           20121102-1733
Build Date            11/2/12
Package               com.ibm.websphere.MON.V80_8.0.1000.20121102_2222
Architecture          x86-64 (64 bit)
Optional Languages    German
                      Russian
                      Korean
                      Brazilian Portuguese
                      Italian
                      French
                      Hungarian
                      Simplified Chinese
                      Spanish
                      Czech
                      Traditional Chinese
                      Japanese
                      Polish
                      Romanian

--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------

答案 2

在此 Eclipse 首选项面板中,您可以将编译器兼容性从 1.7 更改为 1.6。这解决了我收到的类似信息。对于 Eclipse,它位于:首选项 -> Java -> 编译器:'编译器合规性级别'


推荐