0
votes

I am struggling with proving that gradle and gradle-gae-plugin will do the job for us when we develop our GAE java backend.

I have had some success but then took 2 weeks vacation which of course should be punished ...

Now I can't even start the app. All dependencies seems correct and the project compiles alright.

======================================================================

Caused by: java.lang.ClassNotFoundException: com.google.appengine.api.LifecycleManager$ShutdownHook at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:214) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 30 more java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:230) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:307) at com.google.appengine.tools.development.AutomaticServerInstanceHolder.startUp(AutomaticServerInstanceHolder.java:26) at com.google.appengine.tools.development.AbstractServer.startup(AbstractServer.java:80) at com.google.appengine.tools.development.Servers.startup(Servers.java:78) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:216) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:332) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) at com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:268) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:244)

================================

apply plugin: 'gae'
apply plugin: 'eclipse'

ext.version = "130"

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'org.gradle.api.plugins:gradle-gae-plugin:0.8'
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url "http://maven.kungfuters.org/content/groups/public/"        // javapns lives here!
    }
}

configurations {
    all*.exclude module: 'slf4j-log4j12'
}

dependencies {
    def gaeVersion = '1.7.7'
    def jerseyVersion = '1.17.1'

    gaeSdk "com.google.appengine:appengine-java-sdk:$gaeVersion"

    // compile fileTree(dir: 'war/WEB-INF/lib', includes: ['*.jar'])    // TODO: Change this in ze future!

    compile "javax.servlet:servlet-api:2.5"

    compile "commons-cli:commons-cli:1.2"
    compile "org.apache.commons:commons-lang3:3.1"
    compile "org.json:json:20090211"
    compile "javax.ws.rs:jsr311-api:1.1.1"

    compile "org.picocontainer:picocontainer:2.14.3"

    compile "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion"
    compile "com.google.appengine:appengine-api-stubs:$gaeVersion"
    compile "com.google.appengine:appengine-remote-api:$gaeVersion"

    compile "com.google.appengine.tools:appengine-gcs-client:0.3"
    compile "com.google.appengine.tools:appengine-mapreduce:0.2"
    compile "com.google.appengine.tools:appengine-pipeline:0.1"


    compile "com.google.api-client:google-api-client:1.15.0-rc"
    compile "com.google.api-client:google-api-client-appengine:1.15.0-rc"
    compile "com.google.api.client:google-api-client-json:1.2.3-alpha"
    compile "com.google.apis:google-api-services-bigquery:v2-rev97-1.15.0-rc"
    compile "com.google.apis:google-api-services-storage:v1beta2-rev10-1.15.0-rc"
    compile "com.google.http-client:google-http-client:1.15.0-rc"
    compile "com.google.http-client:google-http-client-jackson:1.15.0-rc"

    compile "com.googlecode.javapns:javapns:2.2"

    compile "com.sun.jersey:jersey-core:$jerseyVersion" 
    compile "com.sun.jersey:jersey-server:$jerseyVersion"   
    compile "com.sun.jersey:jersey-servlet:$jerseyVersion" 
    compile "com.sun.jersey:jersey-client:$jerseyVersion"   
    compile "com.sun.jersey:jersey-json:$jerseyVersion"

    compile "org.bouncycastle:bcprov-jdk15on:1.48"

    runtime "org.slf4j:slf4j-jdk14:1.7.5"

    testCompile "junit:junit:4.10"
    testCompile "org.mockito:mockito-all:1.9.0"
    testCompile "com.google.appengine:appengine-testing:$gaeVersion"
}


sourceSets {
    main { java {srcDir 'src' } }
    test { java {srcDir 'testsrc' } }
}

test {
  // set heap size for the test JVM(s)
  minHeapSize = "128m"
  maxHeapSize = "512m"

  // set JVM arguments for the test JVM(s)
  jvmArgs '-XX:MaxPermSize=768m'

  // listen to events in the test execution lifecycle
  beforeTest { descriptor ->
     logger.lifecycle("Running: " + descriptor)
  }
} 

webAppDirName = file('war') 

gae {
    httpPort = 8888
    jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8889', '-Xmx1024m', '-XX:MaxPermSize=512m']
    downloadSdk = true
    warDir = file('war')

    appcfg {
        update {
         useJava7 = true
        }

        email = '[email protected]'
        passIn = true

        logs {
            severity = 1
            numDays = 1
            outputFile = file('dalby.log')
        }

        app {
            id = 'dalby-gunnar'
        }
    }
}

eclipse {
    classpath {
       downloadSources=true
    }
}
1
Looks to me as if one of the AppEngine SDK classes cannot be found the classpath. Any reason why you define them with the configuration gaeSdk and as compile dependencies? I think just assigning them to gaeSdk should do the job.Benjamin Muschko
Hum .. my bad! I followed github.com/bmuschko/gradle-gae-plugin which states .... Alternatively you may choose to automatically download the SDK by setting the convention property downloadSdk to true. This option requires you to specify the SDK version you want to use by setting the configuration gaeSdk. dependencies { gaeSdk 'com.google.appengine:appengine-java-sdk:1.7.3' }Gunnar Eketrapp
I moved gaeSdk deps inside gae {} section and removed compile deps to appengine-api-1.0-sdk and appengine-api-stubs. This works but I get this when i compile :compileJava warning: Supported source version 'RELEASE_6' from annotation processor 'com.google.appengine.tools.compilation.DatastoreCallbacksProcessor' less than -source '1.7' warning: Implicitly compiled files were not subject to annotation processing. Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.Gunnar Eketrapp

1 Answers

0
votes

Sounds like you have to tell the Java compiler (I am assuming your code is written in Java) to set annotation processing. From what I can see in the error message I would try the following:

Disable annotation processing

compileJava.options.compilerArgs = ['-proc:none']

Enable annotation processing

compileJava.options.compilerArgs = ['-implicit']