启动tomcat 报错 Unsupported major.minor version 52.0

项目更新JDK,由之前的1.7更新到1.8,启动tomcat时报错,提示:org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.zdcx.account.ajax.service.impl.OrderInvoiceServiceImpl] for bean with name 'userOrderInvoiceService' defined in file [C:\work\apache-tomcat-7.0.53\wtpwebapps\zdcx-account\WEB-INF\classes\com\zdcx\account\ajax\service\impl\OrderInvoiceServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: com/zdcx/account/ajax/service/impl/OrderInvoiceServiceImpl : Unsupported major.minor version 52.0 (unable to load class com.zdcx.account.ajax.service.impl.OrderInvoiceServiceImpl)

出现这个错误是因为编译的JDK版本,跟运行时所用的JDK版本不一致所导致的:低版本的jvm无法加载高版本的class文件造成的

现在梳理下项目中配置jdk的地方
1,设置Maven编译的版本,maven-compiler-plugin jdk版本 (在pom.xml文件中配置)
<plugins>
            <!-- 指定编译版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <compilerArgument>-parameters</compilerArgument>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>

2,项目的 java compiler
在项目名称上右键 -->选择Properties -->java compiler  选择jdk1.8
启动tomcat 报错 Unsupported major.minor version 52.0 - lisa - lisa

3,Eclipse全局Compiler
在eclipse中点击Window -->preferences --> java --> compiler
启动tomcat 报错 Unsupported major.minor version 52.0 - lisa - lisa

4,tomcat所用的jdk
在eclipse中点击Window -->preferences --> server--> Runtime Environment, 选中tomcat,点击Edit设置jdk
启动tomcat 报错 Unsupported major.minor version 52.0 - lisa - lisa


注:

major.minor version 52.0  对应 jdk版本1.8



注:这篇最初我是写在163博客上的

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值