Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class file is Java 8 but max supported is Java 7 #1230

Closed
grembek opened this issue Feb 9, 2017 · 10 comments
Closed

Class file is Java 8 but max supported is Java 7 #1230

grembek opened this issue Feb 9, 2017 · 10 comments

Comments

@grembek
Copy link

grembek commented Feb 9, 2017

Hi,

I am struggling for two days to deploy my code to Google App Engine and I am unable to do so because of the error "Class file is Java 8 but max supported is Java 7". I tried everything I could find on the web and it is very frustrating that I cannot do so. The App can run locally, but fails I deploy it to the remote server. Can you please advise.

I did everything advised in the IntlliJ guide: https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under

I have the sane problem in Eclipse: GoogleCloudPlatform/google-cloud-eclipse#1365

screen shot 2017-02-09 at 10 50 17
screen shot 2017-02-09 at 10 46 49
screen shot 2017-02-09 at 10 47 58
screen shot 2017-02-09 at 10 49 18
screen shot 2017-02-09 at 10 51 16

Beginning interaction for module default...
0% Scanning for jsp files.
0% Compiling jsp files.
Unable to stage app: Class file is Java 8 but max supported is Java 7: org/eclipse/jetty/apache/jsp/JettyJasperInitializer$1.class in /Users/.../google_appengine/google/appengine/tools/java/jetty93/jetty-distribution/lib/apache-jsp/org.eclipse.jetty.apache-jsp-9.3.14.v20161028-nolog.jar
Please see the logs [/var/folders/24/1d9xwv3536xf_z483zhs_n300000gn/T/appcfg585555938498236650.log] for further information.
Failed to deploy '[2017-02-09 10:45:20] Maven build: replies. Project: replies-server-production. Version: auto': Deployment failed due to an unexpected error while staging the project.

@patflynn
Copy link
Contributor

patflynn commented Feb 9, 2017

Hi @grembek,

Thanks for reporting this issue in such detail.

My first guess is that you're seeing an open bug we have right now with the App Engine SDK where a misleading error message is provided when you use a Java 7 app with a web.xml configured to servlet 3.1 (which doesn't support Java 7).

Can you check your web.xml?

If your web.xml looks like this:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

Then you'll have a problem.

It needs to be updated to:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         version="2.5"
  xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

If that's not your problem, the other thing I'm noting is that you're showing us the IDEA boot JDK, which is not the same as the one used by IntelliJ to build your project.

Have you checked your project settings (⌘;) and verify that your project JDK and module JDKs are set to Java 7 language level?

@chanseokoh
Copy link
Contributor

@grembek
Copy link
Author

grembek commented Feb 10, 2017

The workaround worked by specifying the version of the xml as 2.5

@patflynn
Copy link
Contributor

#1231
#1193

@atulchavan10000
Copy link

i am using Eclipse neon. in my case it was already 2.5, but when i changed the whole text as suggested by patflynn it worked.

@narbigcito
Copy link

i am using eclipse Oxigen and my web-app version is 2.5, but is not working, i have the same error "Class file is Java 8 but max supported is Java 7" i am using java 8 but i can't chage to java 7

@etanshaul
Copy link
Contributor

@narbigcito is your goal to use java 7, or java 8?

You can use the Java 8 runtime on app engine standard if you choose.

Could you perhaps post the contents of your appengine-web.xml (stripping out sensitive data)?

@narbigcito
Copy link

narbigcito commented Jan 9, 2018

Thanks @etanshaul , adding the following worked:

<runtime>java8</runtime>

@etanshaul
Copy link
Contributor

great! thanks for the update

@elich11
Copy link

elich11 commented Jan 28, 2019

Just to be more clear, what fixed it for me is adding the <runtime>java8</runtime> to appengine-web.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants