本文介绍了Tomcat 7是否支持Java 8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tomcat的官方页面中,它说Tomcat 7支持Java 8.并与Java 8一起运行.

In offcial page of Tomcat it says that Tomcat 7 supports Java 8. If I download this and run with Java 8 it works.

但是,在Openshift上是 Tomcat 7(JBoss EWS 2.0).在此网页中,它说EWS 2.0 不支持Java 8 .如果我将Java 8应用程序部署到Openshift(Tomcat 7),它将无法正常工作.

But, on Openshift is Tomcat 7 (JBoss EWS 2.0). In this webpage it says that EWS 2.0 doesn't support Java 8. If I deploy my Java 8 application to Openshift (Tomcat 7) it isn't working.

为什么?

我尝试使用以下方法在Openshift的Tomcat 7上安装Java 8: https://stackoverflow.com/a/23895161/2442133 但这对我不起作用.我有错误:

I tried to install Java 8 on Tomcat 7 on Openshift with this: https://stackoverflow.com/a/23895161/2442133But it isnt' working for me. I have error:

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading
class [pl.xxx.controller.HomeController] for bean with name 'homeController'
defined in file [/var/lib/openshift/xxx/app-
root/runtime/dependencies/jbossews/webapps/web1/WEB-
INF/classes/xxx/controller/HomeController.class]: problem with class file or
dependent class; nested exception is java.lang.UnsupportedClassVersionError:
xxx/controller/HomeController : Unsupported major.minor version 52.0 (unable to
load class xxx.controller.HomeController)

Unsupported major.minor version 52.0说Java版本是错误的(Java 7集成Java 8).

Unsupported major.minor version 52.0 says that Java version is wrong (Java 7 intead Java 8).

推荐答案

Unsupported major.minor version 52.0错误表明您具有Java 8类文件,但Java< = 7 JRE.因此,您根本没有成功为Tomcat安装Java 8.您可能需要调整Tomcat配置中的某些内容才能使其使用Java 8.

The Unsupported major.minor version 52.0 error says that you have a Java 8 class file but a Java <= 7 JRE. So you haven't succeeded in installing Java 8 for Tomcat at all. You may need to adjust something in the Tomcat configuration to make it use Java 8.

这篇关于Tomcat 7是否支持Java 8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 09:32