首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > Ruby Rails >

非一般的解决UnsupportedClassVersionError错误

2012-07-02 
非一般的解决UnsupportedClassVersionError异常Java代码 2008-03-17 19:33:12 ERROR ContextLoader:205 -

非一般的解决UnsupportedClassVersionError异常

Java代码
2008-03-17 19:33:12 ERROR ContextLoader:205 - Context initialization failed??
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [...] for bean with name 'roleSolutionDao' defined in class path resource [.../applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file??
Caused by:???
java.lang.UnsupportedClassVersionError: Bad version number in .class file??
??? at java.lang.ClassLoader.defineClass1(Native Method)?

2008-03-17 19:33:12 ERROR ContextLoader:205 - Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [...] for bean with name 'roleSolutionDao' defined in class path resource [.../applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file
Caused by:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
??? at java.lang.ClassLoader.defineClass1(Native Method)


在网上查了很多资料都是说本机装了两个JDK,JDK版本不同间的冲突.
但我本机只有一个JDK. 不应该是这个问题.
重装了JDK都没用.

还是同事厉害,找到问题所在了.见下图:

Java代码
<?xml version="1.0" encoding="UTF-8"?>??
<faceted-project>??
? <fixed facet="jst.java"/>??
? <fixed facet="jst.utility"/>??
? <installed facet="jst.java" version="5.0"/>??
? <installed facet="jst.utility" version="1.0"/>??
</faceted-project>?

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
? <fixed facet="jst.java"/>
? <fixed facet="jst.utility"/>
? <installed facet="jst.java" version="5.0"/>
? <installed facet="jst.utility" version="1.0"/>
</faceted-project>

里面的5.0是修改后的,修改前是6.0.

Java代码
#Mon Jan 28 15:04:15 CST 2008?
eclipse.preferences.version=1?
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5?
org.eclipse.jdt.core.compiler.compliance=1.5?
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error??
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error??
org.eclipse.jdt.core.compiler.source=1.5?

#Mon Jan 28 15:04:15 CST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

里面的1.5都是从1.6修改过来的.

这个项目是从同事手中交接过来的,同事是使用JDK1.6的.

修改后,重启tomcat,问题解决了.

热点排行