在Google App Engine上运行的Spring Boot Web应用程序 - 抛出jetty异常

时间:2018-03-26 13:24:53

标签: google-app-engine spring-boot spring-boot-gradle-plugin

当我执行gradlew appengineRun时,我一直得到:

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

我有一台Windows 7主机。相同的程序与gradlew bootRun运行良好。 我没有使用web.xml。但我的build.gradle与https://cloud.google.com/appengine/docs/standard/java/tools/gradle一致。 我没有经历eclipse(类似的问题在这里报道:mvn appengine:run - error 403 (spring boot web with jsp))。 springBootVersion =&#39; 2.0.0.BUILD-SNAPSHOT&#39;

的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

1 个答案:

答案 0 :(得分:2)

问题正由https://issuetracker.google.com/issues/65200034上游跟踪。请为该问题加注星标以接收更新。

详细信息

我们认为您的问题是https://github.com/eclipse/jetty.project/issues/1892https://issuetracker.google.com/issues/65200034最初约为https://github.com/eclipse/jetty.project/issues/1692,但它已扩展到涵盖您的问题。