`

UnsupportedClassVersionError:JVMCFRE003bad 问题分析与解决

    博客分类:
  • Java
阅读更多

问题分析

com.ibm.ws.webcontainer.annotation.WASAnnotationHelpercollectClasses unable to instantiate class

java.lang.UnsupportedClassVersionError:JVMCFRE003bad major version;class=com/soa/listener/SpringContextLoaderListener, offset=6

at java.lang.ClassLoader.defineClassImpl(NativeMethod) at java.lang.ClassLoader.defineClass(ClassLoader.java:28

 

//解决方案与方法如下:

http://stackoverflow.com/questions/14926402/unsupportedclassversionerror-jvmcfre003-bad-major-version-in-websphere-as-7

 

up vote17down voteaccepted

WebSphere Application Server V7 does supportJava Platform, Standard Edition (Java SE) 6(seeSpecifications and API documentationin the Network Deployment (All operating systems), Version 7.0 Information Center) and it's sincethe release V8.5 when Java 7 has been supported.

I couldn't find the Java 6 SDK documentation, and could only consultIBM JVM MessagesinJava 7 Windows documentation. Alas, I couldn't find the error message in the documentation either.

Sincejava.lang.UnsupportedClassVersionErroris"Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.", you ran into an issue of building the application with more recent version of Java than the one supported by the runtime environment, i.e. WebSphere Application Server 7.0.

I may be mistaken, but I think thatoffset=6in the message is to let you know what position caused the incompatibility issue to occur. It's irrelevant for you, for me, and for many other people, but some might find it useful, esp. when they generate bytecode themselves.

Run theversionInfocommand to find out about theInstalled Featuresof WebSphere Application Server V7, e.g.

C:\IBM\WebSphere\AppServer>.\bin\versionInfo.bat
WVER0010I:Copyright(c) IBM Corporation2002,2005,2008;All rights reserved.
WVER0012I:VersionInfo reporter version 1.15.1.47, dated 10/18/11--------------------------------------------------------------------------------
IBM WebSphereProductInstallationStatusReport--------------------------------------------------------------------------------Report at date and time February19,20138:07:20 AM EST

Installation--------------------------------------------------------------------------------ProductDirectory        C:\IBM\WebSphere\AppServer
VersionDirectory        C:\IBM\WebSphere\AppServer\properties\version
DTD Directory            C:\IBM\WebSphere\AppServer\properties\version\dtd
LogDirectory            C:\ProgramData\IBM\Installation Manager\logs

ProductList--------------------------------------------------------------------------------
BPMPC                    installed
ND                       installed
WBM                      installed

InstalledProduct--------------------------------------------------------------------------------Name                  IBM BusinessProcessManagerAdvanced V8.0Version8.0.1.0
ID                    BPMPC
BuildLevel20121102-1733BuildDate11/2/12Package               com.ibm.bpm.ADV.V80_8.0.1000.20121102_2136
Architecture          x86-64(64 bit)InstalledFeaturesNon-production
                      BusinessProcessManagerAdvanced-Client(always installed)OptionalLanguagesGermanRussianKoreanBrazilianPortugueseItalianFrenchHungarianSimplifiedChineseSpanishCzechTraditionalChineseJapanesePolishRomanianInstalledProduct--------------------------------------------------------------------------------Name                  IBM WebSphereApplicationServerNetworkDeploymentVersion8.0.0.5
ID                    ND
BuildLevel           cf051243.01BuildDate10/22/12Package               com.ibm.websphere.ND.v80_8.0.5.20121022_1902
Architecture          x86-64(64 bit)InstalledFeatures    IBM 64-bit SDK forJava,Version6EJBDeploy tool for pre-EJB 3.0 modules
                      Embeddable EJB container
                      Sample applications
                      Stand-alone thin clients and resource adapters
OptionalLanguagesGermanRussianKoreanBrazilianPortugueseItalianFrenchHungarianSimplifiedChineseSpanishCzechTraditionalChineseJapanesePolishRomanianInstalledProduct--------------------------------------------------------------------------------Name                  IBM BusinessMonitorVersion8.0.1.0
ID                    WBM
BuildLevel20121102-1733BuildDate11/2/12Package               com.ibm.websphere.MON.V80_8.0.1000.20121102_2222
Architecture          x86-64(64 bit)OptionalLanguagesGermanRussianKoreanBrazilianPortugueseItalianFrenchHungarianSimplifiedChineseSpanishCzechTraditionalChineseJapanesePolishRomanian--------------------------------------------------------------------------------EndInstallationStatusReport--------------------------------------------------------------------------------
shareimprove this answer
 
1  
hi i have same problem but i cannot understand how to fix it. Can you provide some direct answer for this issueHimanshuMar 27 '13 at 18:14
   
i am using webspare 8.5 where webspare use 1.6 internal and my eclipse compiler 1.7HimanshuMar 27 '13 at 18:16
5  
If you use a Java 7 compiler and target a Java 6 environment you need to set up the higher-version compiler to generate 1.6-compliant bytecode. See-sourceand-targetoptions ofjavac.Jacek LaskowskiApr 2 '13 at 12:55
 

In this Eclipse Preferences panel you can change the compiler compatibility from 1.7 to 1.6. This solved the similar message I was getting. For Eclipse, it is under: Preferences -> Java -> Compiler: 'Compiler compliance level'

shareimprove this answer
 

This error can occur if you project is compiling with JDK 1.6 and you have dependencies compiled with Java 7.

shareimprove this answer
 
   
Exactly. This normally happens in maven projectsKrisMay 27 at 21:06

You should also make sure you have set appropriate Project Facets Java version. Module Properties -> Project Facets -> Java 1.6 should be checked

shareimprove this answer
 

I was getting this error in websphere 8.5:

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=com/xxx/Whatever, offset=6

I had my project JDK level set at 1.7 in eclipse and was8 by default runs on JDK 1.6 so there was a clash. I had to install the optional SDK 1.7 to my websphere server and then the problem went away. I guess I could have also set my project level down to 1.6 in eclipse but I wanted to code to 1.7.

shareimprove this answer
 

I was getting the same error. In the Project Facets of my Java project, the Java compile level was set to 1.7 whereas the WebSphere Application Server v7.0 had a Runtime Composition of JRE v1.6; setting the Java compile level to 1.6 in Project Facets got rid of the error. I did not have to change the Compiler compliance level though, it's still 1.7. Hope this helps!

shareimprove this answer
 

At firstyou should check major version of compiled problematic.classfile, in your casemap/CareMonths. Seethis answerhow to do it.

WAS7 uses Java 6 (as said Jacek), and Java 6 uses major version 50, soyou have to compile your project with Java 6. How to set proper version of Java compiler depends on your IDE (e.g. Eclipse, IntelliJ) or build tool (e.g. Maven, Ant).

 

 

分享到:
评论

相关推荐

    java.lang.UnsupportedClassVersionError Bad version number in .class file异常的解决办法

    ### java.lang.UnsupportedClassVersionError: Bad version number ...通过上述方法,可以有效地解决`java.lang.UnsupportedClassVersionError: Bad version number in .class file`异常问题,并确保项目能够平稳运行。

    java.lang.UnsupportedClassVersionError问题的解决方法

    如果上述操作仍无法解决问题,可以尝试更换其他版本的JDK进行测试,直到找到一个合适的版本为止。 #### 二、运行时出现UnsupportedClassVersionError的处理方法 如果在项目运行过程中出现了`...

    java.lang.UnsupportedClassVersionError问题解决

    ### java.lang.UnsupportedClassVersionError问题解析与解决方案 在Java开发过程中,经常会在部署或运行时遇到`java.lang.UnsupportedClassVersionError`错误。该错误通常发生在类文件版本与JVM(Java虚拟机)版本...

    mysql-connection-java-5.1.28.jar下载j ava.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver :-附件资源

    mysql-connection-java-5.1.28.jar下载j ava.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver :-附件资源

    严重: Servlet.service() for servlet jsp threw exception java.lang.UnsupportedClassVersionError: com/ut

    java.lang.UnsupportedClassVersionError: com/util/PostUtil  at org.apache.jsp.shouye.index_jsp._jspService(index_jsp.java:84)  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)  ...

    tomcat:bad version number in class file的解决方法

    "tomcat:bad version number in class file的解决方法" Tomcat 是一个流行的开源 Web 服务器和 servlet 容器,广泛应用于 Web 应用程序的开发和部署。然而,在使用 Tomcat 时,可能会出现 "bad version number in ...

    java jdk安装向导

    ### Java JDK 安装与Eclipse集成指南 #### 一、前言 本文档旨在指导初学者如何正确安装Java Development Kit (JDK)并配置Eclipse集成开发环境(IDE),以便进行Java应用开发。JDK是Java编程语言的基础工具包,而...

    jeecms源码级安装使用文档

    Jeecms是一款基于Java技术的开源内容管理系统,专为中大型网站提供高效、稳定、灵活的建站解决方案。本文档将深入讲解Jeecms 3.0.4版本的源码安装与使用过程,帮助开发者全面了解其内部机制,以便更好地进行二次开发...

    Java编译错误-UnsupportedClassVersionError.txt

    “Java编译错误 - UnsupportedClassVersionError”这一标题明确指出了解决的问题核心是Java中的`UnsupportedClassVersionError`异常。这是一种常见的运行时错误,通常发生在试图用一个较低版本的JVM去加载由较高版本...

    SpringTest

    SpringTest 是一个与Java开发相关的主题,主要集中在Spring框架的测试方面。Spring是企业级Java应用的主流框架,它提供了一整套服务,包括依赖注入、面向切面编程、数据访问、事务管理以及各种Web应用的支持。在...

    dextojar与baksmali

    逆向工程,即对已编译的代码进行分析,理解其内部工作原理,是黑客常用的技术手段,但也被开发者用于调试和优化。在这个领域,"dextojar" 和 "baksmali" 是两个关键的工具,它们主要用于Android应用的逆向工程过程。...

    p4jorm 1.6编译版本

    开始那个版本是1.7,有些同学遇到“java.lang.UnsupportedClassVersionError: Bad version ”问题,如果是jdk 1.6,请用此版本,或者自己编译一个,因为已发布源码

    Apktool资源反编译

    apktool1.4.1.tar.bz2 和 apktool-install-windows-r04-brut1.tar.bz2(两个包都下载)反编译apk生成程序的源代码和图片、XML配置、语言资源等文件

    PowerDesigner v15.1汉化破解版

    PowerDesigner v15.1汉化破解版,可直接覆盖安装目录汉化破解

    java异常解决方案.docx

    * java.lang.UnsupportedClassVersionError: Bad version number in .class file + 解决方案:检查 Java 的版本是否正确,是否存在版本不兼容的问题,尝试使用 compatible 的 Java 版本来解决问题。 四、JSP 异常...

    Retrotranslator

    当我们引入的jar包和本地的jdk版本有冲突的情况下,会报一下错误:java.lang.UnsupportedClassVersionError:com/sun/tools/javac/Main : Unsupported major.minor version 51.0,所以我们需要强制给jar依赖的jdk版本...

    scraper-one:第一个仅使用 Java 的刮刀项目

    我花了一整天来解决这个问题:( jdk 1.7.0_51 上的 UTC+3 不正确使用 bash 运行 scraper-1.0-SNAPSHOT.jar 时遇到 java.lang.UnsupportedClassVersionError: Bad version number in .class file。 在 Windows 上使用...

    22_尚硅谷大数据之MapReduce_常见错误及解决方案1

    解决方案:调整reducetask个数,使其与partition个数相匹配。 4. 如果分区数不是1,但是reducetask为1,是否执行分区过程。答案是:不执行分区过程。因为在maptask的源码中,执行分区的前提是先判断reduceNum个数...

    java程序调试错误收集

    - **问题描述**:在部署或编译项目时遇到`java.lang.UnsupportedClassVersionError: Bad version number in .class file`异常。 - **解决方案**: - 检查当前使用的JDK版本是否与项目编译时所用的JDK版本一致。 - ...

Global site tag (gtag.js) - Google Analytics