GoogleCloudPlatform / gradle-appengine-plugin

Gradle plugin that provides tasks for uploading, running and managing Google App Engine projects
Apache License 2.0
236 stars 60 forks source link

Invalid "Java 6 applications are prevented from being deployed" error message #257

Closed marceloverdijk closed 8 years ago

marceloverdijk commented 8 years ago

It'a long time I tried appengine but I when using gradlew appengineUpdate I get the below "Java 6 applications are prevented from being deployed" error despite I'm using Java 7.

I also used used:

$ javap -verbose My.class | grep "major"
  major version: 51

To verify my classes are Java 7.

I'm using Gradle 2.14.1 and Appengine 1.9.40.

400 Bad Request
Java 6 applications are prevented from being deployed to Google App Engine from any version of the SDK, including older ones. If you need to continue to deploy Java 6 applications for compatibility reasons, you can request that your application be whitelisted for Java 6 deployment by visiting http://goo.gl/ycffXq.
loosebazooka commented 8 years ago

Yeah that looks like a pretty old code path. Perhaps you're doing something that's triggering it, but that's not the real problem. Are you using Java 8 anywhere?

marceloverdijk commented 8 years ago

Hi, do you think the same error is shown when using Java 8? The classes are Java 7 but my java home is indeed Java 8.... I'm using gradle.properties to set JDK7.

marceloverdijk commented 8 years ago

Even with JAVA_HOME explicitly set to JDK 7 and running Gradle with --no-daemon option I get the same error.

To proof this is my output for:

$ ./gradlew -v

------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------

Build time:   2016-07-18 06:38:37 UTC
Revision:     d9e2113d9fb05a5caabba61798bdb8dfdca83719

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.7.0_79 (Oracle Corporation 24.79-b02)
OS:           Mac OS X 10.11.4 x86_64

I wonder how Google determines that it think it's running Java 6...

loosebazooka commented 8 years ago

Perhaps it has something to do with your configuration. Can you show us your appengine-web.xml and build.gradle (feel free to replace anything identifying parts)

On Aug 4, 2016 14:01, "Marcel Overdijk" notifications@github.com wrote:

Even with JAVA_HOME explicitly set to JDK 7 and running Gradle with --no-daemon option I get the same error.

To proof this is my output for:

$ ./gradlew -v


Gradle 2.14.1

Build time: 2016-07-18 06:38:37 UTC Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719

Groovy: 2.4.4 Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM: 1.7.0_79 (Oracle Corporation 24.79-b02) OS: Mac OS X 10.11.4 x86_64

I wonder how Google determines that it think it's running Java 6...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/257#issuecomment-237633303, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPo-vH3nFxJMh5VWAA-BYH7E8TnZpirks5qcijygaJpZM4JcvWS .

marceloverdijk commented 8 years ago

Nothing to hide, here is my build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "com.google.appengine:gradle-appengine-plugin:1.9.40"
    }
}

apply plugin: "java"
apply plugin: "idea"
apply plugin: "war"
apply plugin: "appengine"

ext {
    appengineVersion = "1.9.40"
    commonsLang3Version = "3.4"
    javaVersion = "1.7"
    servletVersion = "2.5"
}

repositories {
    mavenCentral()
}

dependencies {
    appengineSdk "com.google.appengine:appengine-java-sdk:${appengineVersion}"
    compile "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}"
    compile "org.apache.commons:commons-lang3:${commonsLang3Version}"
    providedCompile "javax.servlet:servlet-api:${servletVersion}"
}

appengine {
    disableUpdateCheck = true
    downloadSdk = true
    httpPort = 8088
    jvmFlags = [
            "-Ddatastore.backing_store=${projectDir}/local_db.bin"
    ]
    appcfg {
        noCookies = true
        oauth2 = true
        app {
            id = "fb-hilo-test"
        }
    }
}

clean {
    delete "local_db.bin"
}

compileJava {
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
}

idea {
    module {
        downloadJavadoc = true
        downloadSources = true
        inheritOutputDirs = false
        outputDir = file("${buildDir}/classes/main")
        testOutputDir = file("${buildDir}/classes/test")
    }
}

task wrapper(type: Wrapper) {
    description = "Generates gradlew[.bat] scripts."
    gradleVersion = "2.14.1"
}

gradle.properties contains:

org.gradle.daemon=false
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

And my app.yaml:

application: fb-hilo-test
version: 1
runtime: java
sessions_enabled: false
threadsafe: true

handlers:
  - url: /heartbeat
    name: heartbeatServlet
    servlet: com.github.marceloverdijk.fb.hilo.servlet.HeartbeatServlet
    login: admin
  - url: /webhook
    name: webHookServlet
    servlet: com.github.marceloverdijk.fb.hilo.servlet.WebHookServlet

error_handlers:
  - file: default_error.html

static_files:
  - include: /assets/**
  - include: /default_error.html

system_properties:
  java.util.logging.config.file: WEB-INF/logging.properties
marceloverdijk commented 8 years ago

The code is on github: https://github.com/marceloverdijk/fb-messenger-hilo-game Thanks for help!

marceloverdijk commented 8 years ago

I also noticed the Gradle plugin is at 1.9.40 but appengine itself already on 1.9.42 but don't think that should be an issue in my case.

loosebazooka commented 8 years ago

So you've built an appengine project with only an app.yaml and no appengine-web.xml? Do you know which step is error in out on you appenineStage or appengineDeploy? "Runtime: Java" may not have the meaning you expect to here in the app.yaml, usually standard appengine apps have runtime java7 or their app.yaml is generated from appengine-web.xml. Did you reference a specific example or document when building this project?

On Aug 4, 2016 14:07, "Marcel Overdijk" notifications@github.com wrote:

The code is on github: https://github.com/marceloverdijk/fb-messenger- hilo-game Thanks for help!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/257#issuecomment-237635155, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPo-u05tEMaT6_5NTTthKBfYZNt9CTgks5qcipygaJpZM4JcvWS .

marceloverdijk commented 8 years ago

I think it's the other way arround, app.yaml is used to generate the appengine-web.xml, at least ages ago when I used appengine.

In my target folder I indeed have appengine-web.xmlcontaining:

<!-- Generated from app.yaml. Do not edit. -->
<appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>
  <application>fb-hilo-test</application>
  <version>1</version>
  <runtime>java</runtime>
  <static-files>
    <include path='/assets/**'/>
    <include path='/default_error.html'/>
  </static-files>
  <resource-files>
  </resource-files>
  <ssl-enabled>true</ssl-enabled>
  <precompilation-enabled>true</precompilation-enabled>
  <threadsafe>true</threadsafe>
  <code-lock>false</code-lock>
  <sessions-enabled>false</sessions-enabled>
  <system-properties>
    <property name='java.util.logging.config.file' value='WEB-INF/logging.properties'/>
  </system-properties>
  <warmup-requests-enabled>false</warmup-requests-enabled>
  <static-error-handlers>
    <handler file='default_error.html'/>
  </static-error-handlers>
</appengine-web-app>
marceloverdijk commented 8 years ago

runtime: java7 (instead of runtime: java) did the trick.

Maybe that has been changed since I used appengine last time...

I have an old app using 1.9.26 which used runtime: java without problems.

marceloverdijk commented 8 years ago

Thanks again for the help!

loosebazooka commented 8 years ago

I'm not really sure the app.yaml -> appengine-web.xml is encouraged much. @patflynn ?

marceloverdijk commented 8 years ago

I really like it :-) to avoid xml as much as possible

patflynn commented 8 years ago

@ludoch

yeah my understanding is that the Java App Engine Standard runtime toolchain requires doing configuration in the appengine-web.xml. We don't really support the app.yaml -> appengine-web.xml conversion flow anymore, and you definitely can't have the configuration in both file types. I do not know however whether you can simply use app.yaml directly from a standard app. I'm not sure if the staging command supports that.

marceloverdijk commented 8 years ago

Hmm, I have only an app.yaml and it seems to work, both servlets defined in my app.yaml are active..