5

When I execute gradlew appengineRun, I consistently get:

Starting a Gradle Daemon (subsequent builds will be faster)
Mar 26, 2018 5:47:48 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
2018-03-26 17:47:51.665:INFO::main: Logging initialized @3872ms
2018-03-26 17:47:53.727:INFO:oejs.Server:main: jetty-9.3.18.v20170406
2018-03-26 17:48:01.040:WARN:oeja.ClassInheritanceHandler:qtp99347477-18:
java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
    at org.eclipse.jetty.annotations.ClassInheritanceHandler.addToInheritanceMap(ClassInheritanceHandler.java:72)
    at org.eclipse.jetty.annotations.ClassInheritanceHandler.handle(ClassInheritanceHandler.java:58)
    at org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor.visit(AnnotationParser.java:476)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:650)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:525)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:978)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:958)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:902)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
2018-03-26 17:48:01.087:WARN:oeja.ClassInheritanceHandler:qtp99347477-19:
java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
    at org.eclipse.jetty.annotations.ClassInheritanceHandler.addToInheritanceMap(ClassInheritanceHandler.java:72)
    at org.eclipse.jetty.annotations.ClassInheritanceHandler.handle(ClassInheritanceHandler.java:58)
    at org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor.visit(AnnotationParser.java:476)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:650)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:525)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:978)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:958)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:902)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
2018-03-26 17:48:01.103:WARN:oeja.ClassInheritanceHandler:qtp99347477-12:
java.lang.NullPointerException

I have a Windows 7 host. The same program runs fine with gradlew bootRun. I am not using a web.xml. But my build.gradle is along the lines of https://cloud.google.com/appengine/docs/standard/java/tools/gradle. I am not running through eclipse (similar problem is reported here: mvn appengine:run - error 403 (spring boot web with jsp)). springBootVersion = '2.0.0.BUILD-SNAPSHOT'

build.gradle:

buildscript {
    ext {
        springBootVersion = '2.0.0.BUILD-SNAPSHOT'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'    // latest App Engine Gradle tasks
    }
}

apply plugin: 'java'                              // standard Java tasks
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.cloud.tools.appengine'  // App Engine tasks

ext['thymeleaf.version'] = '3.0.9.RELEASE'

compileJava {
    options.warnings = true
    options.debug = true
    options.compilerArgs += ["-Xlint:deprecation"]
}

sourceSets {
    main {
        java {
            exclude '**/RedirectHttpToHttpsOnTomcatConfig.java'
            exclude '**/RedirectHttpToHttpsOnJettyConfig.java'
            exclude '**/RedirectHttpToHttpsOnJetty2Config.java'
            exclude '**/RedirectHttpToHttpsOnJetty3Config.java'
            exclude '**/RedirectHttpToHttpsOnJetty4Config.java'
       }
   }
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}

dependencies {
    compile 'com.google.appengine:appengine-api-1.0-sdk:+'  // Latest App Engine Api's
    providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
    compile 'jstl:jstl:1.2'

    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile("org.springframework.boot:spring-boot-starter-web") {
        exclude module: "spring-boot-starter-tomcat"
    }
    compile("org.springframework.boot:spring-boot-starter-jetty")
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4')
    compile("org.springframework.boot:spring-boot-starter-jdbc") {
        exclude module: "org.apache.tomcat:tomcat-juli"
    }
    compile("org.springframework.boot:spring-boot-starter-data-jpa") {
        exclude module: "org.apache.tomcat:tomcat-juli"
    }
    compile("com.h2database:h2")
    providedRuntime 'org.slf4j:jul-to-slf4j'
}

configurations {
    compile.exclude module: 'spring-boot-starter-tomcat'
    runtime.exclude module: 'spring-boot-starter-tomcat'
}

appengine {  // App Engine tasks configuration
  deploy {   // deploy configuration

  }
}

sourceCompatibility = 1.8     // App Engine Flexible uses Java 8
targetCompatibility = 1.8     // App Engine Flexible uses Java 8
Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
Vinay
  • 153
  • 1
  • 2
  • 10

1 Answers1

2

The issue is being tracked upstream by https://issuetracker.google.com/issues/65200034. Please star that issue to receive updates.

Details

We believe your issue is https://github.com/eclipse/jetty.project/issues/1892. https://issuetracker.google.com/issues/65200034 was originally about https://github.com/eclipse/jetty.project/issues/1692, but it has expanded to cover your issue too.

Chanseok Oh
  • 3,920
  • 4
  • 23
  • 63
  • Thanks. Will follow up there as well. But still wondering how to run a Spring Boot application (.war) with Gradle build on App Engine Standard. – Vinay Mar 26 '18 at 16:10
  • Don't forget https://github.com/eclipse/jetty.project/issues/1797 (it's more all encompassing of the JEP 238 issues) – Joakim Erdfelt Mar 26 '18 at 16:13
  • @Vinay are you talking about running the application locally with the dev appserver or deploying it to App Engine standard? In any case, I see you are already using the Google Cloud Gradle plugin. Please consult the official doc: https://cloud.google.com/appengine/docs/standard/java/tools/gradle As long as your Spring Boot .war is no different than the usual .war format, there should be no difference. – Chanseok Oh Mar 27 '18 at 17:44
  • Thanks. As mentioned, the same program runs fine with gradlew bootRun and java -jar build\libs\xyz.war on localHost. Not sure if this can still be a war problem. I have followed the official doc. It seems there is known issue for running Spring Boot web applications on Google App Engine (Jetty) - as mentioned above. – Vinay Mar 30 '18 at 12:27
  • @Vinay Looks like Spring Boot created an executable JAR instead of a pure WAR, as "java -jar *.war" works. That's the default behavior of Spring Boot. Unpack the .war file and check if it is a pure WAR. I believe you can change your project setting so that Spring Boot doesn't create an executable JAR but a pure WAR. – Chanseok Oh Apr 01 '18 at 01:12
  • @Vinay, if you think that Chanesok's answer was correct, you should consider accepting it to confirm that your issue has been solved. Thank you. – Rodrigo C. Apr 04 '18 at 14:06
  • 1
    @Rodrigo, Thanks. Well Sprint Boot application (security enabled) just didn't work on App Engine (Jetty). After exploring various online forums and trying multiple options, I eventually had to abandon App Engine. I selected a Cloud Platform with Tomcat and Apache, and then could finally have it working there. Encountered quite a few issues with Jetty + App Engine: lack of consolidated documentation, specifics around permissions/ports for web container, and details of configuring HTTPS/SSL. – Vinay Apr 06 '18 at 03:01