出现 org.apache.tomcat.util.bcel.classfile.ClassFormatException 异常的原因及解决方法
2017-04-14 18:01
956 查看
1 异常描述
在从 SVN 正常检出项目后,部署完 Maven 及配置完 Tomcat 之后,按常规方法启动服务器,报出如下错误:2 异常原因
通过观察上图标记出来的异常描述,咱们可以知道:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
此异常,为:ClassFormatException,类格式异常。
也就是说,Java jdk 的版本选择有问题,编译时用的 jdk 与现在运行时用的 jdk 版本不兼容,从而导致此异常的发生。
倒是和“Java.lang.UnsupportedClassVersionError:Unsupported major.minor version 51.0”,这个异常有些类似。
3 解决方法
既然咱们已经知道了此异常发生的原因,那么更换 jdk 之后,即可解决此问题。悄悄的说一句,虽然知道异常发生的原因,但博主在解决这个异常的时候,却花费了很长时间。至于原因嘛,项目编译时用的 jdk 是
1.6.0_21,但是运行项目时,博主使用的 jdk 是
1.6.0_65版本,报出此异常;之后,更换 jdk 为
1.8.0_112版本后仍然报出此异常。
最后测试完,发现 jdk 高于
1.6.0_21版本的
1.6.0_39和
1.7.0_67可以运行,我也是醉啦!这谁能想到呢?囧。
相关文章推荐
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file 的解决方法
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file 的解决方法
- 出现 org.apache.tomcat.xxx.ClassFormatException: Invalid byte tag in constant pool: 15 异常的原因及解决方法
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool问题解决方案
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java .class file
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java .class file
- org.apache.tomcat.util.bcel.classfile.ClassFormatException
- org.apache.tomcat.util.bcel.classfile.ClassFormatException:it is not a Java .class file
- maven org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java .class file
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
- 异常:Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'--解决方法
- 出现 org.apache.ibatis.binding.BindingException 异常的原因及解决方法
- POI操作excel2007 出现异常 java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions 解决方法
- 出现 java.util.zip.ZipException: error in opening zip file 异常的原因及解决方法