При выполнении задачи gradle appengineRun
мои текущие проекты весенней загрузки загружаются ( два раза!? ), но недоступны через localhost (jetty
):
15:46:39: Executing task 'appengineRun'...
> Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :processResources
> Task :classes
> Task :bootWar
> Task :war SKIPPED
> Task :explodeWar
> Task :assemble
Jun 03, 2018 3:46:51 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFORMATION: Overwriting system property key 'java.util.logging.config.file', value '/Users/sullrich/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/config/sdk/logging.properties' with value 'WEB-INF/logging.properties' from '/Users/sullrich/github/WettkampfDB/build/exploded-WettkampfDB/WEB-INF/appengine-web.xml'
2018-06-03 15:46:52.110:INFO::main: Logging initialized @590ms
2018-06-03 15:46:52.452:INFO:oejs.Server:main: jetty-9.3.18.v20170406
2018-06-03 15:46:53.939:WARN:oeja.ClassInheritanceHandler:qtp710714889-15:
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-06-03 15:46:55.196:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=2357ms
Jun 03, 2018 1:46:56 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
INFORMATION: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
13:46:56 INFO [de.deepsource.container.ServletInitializer] : Starting WettkampfDB via SpringBootServletInitializer
[project boot logs; then second start ...]
13:47:10 INFO [de.deepsource.container.ServletInitializer] : Started ServletInitializer in 13.613 seconds (JVM running for 18.539)
Jun 03, 2018 1:47:10 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
INFORMATION: javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'dispatcherServlet'
13:47:10 INFO [org.springframework.web.servlet.DispatcherServlet] : FrameworkServlet 'dispatcherServlet': initialization started
13:47:10 INFO [org.springframework.web.servlet.DispatcherServlet] : FrameworkServlet 'dispatcherServlet': initialization completed in 12 ms
2018-06-03 15:47:10.294:INFO:oejsh.ContextHandler:main: Started c.g.a.t.d.j.DevAppEngineWebAppContext@6318ff9{/,file:///Users/sullrich/github/WettkampfDB/build/exploded-WettkampfDB/,AVAILABLE}{/Users/sullrich/github/WettkampfDB/build/exploded-WettkampfDB}
2018-06-03 15:47:10.304:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@3f2d2f22{HTTP/1.1,[http/1.1]}{localhost:4000}
2018-06-03 15:47:10.310:INFO:oejs.Server:main: Started @18790ms
Jun 03, 2018 1:47:10 PM com.google.appengine.tools.development.AbstractModule startup
INFORMATION: Module instance default is running at http://localhost:4000/
Jun 03, 2018 1:47:10 PM com.google.appengine.tools.development.AbstractModule startup
INFORMATION: The admin console is running at http://localhost:4000/_ah/admin
2018-06-03 15:47:10.371:INFO:oejs.Server:main: jetty-9.3.18.v20170406
2018-06-03 15:47:10.836:WARN:oeja.ClassInheritanceHandler:qtp827966648-38:
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-06-03 15:47:11.798:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=1343ms
Jun 03, 2018 1:47:12 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
INFORMATION: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
13:47:12 INFO [de.deepsource.container.ServletInitializer] : Starting WettkampfDB via SpringBootServletInitializer
Я не понимаю, почему два WebApplicationInitializers
находятся в моем классе:
INFORMATION: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
Мой Server.class
:
@Log4j2
@SpringBootApplication
@EnableAsync
@EnableWebMvc
@EnableCaching
@EnableWebSecurity
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
@EnableAutoConfiguration
@ComponentScan("de.deepsource")
@EntityScan("de.deepsource")
@EnableJpaRepositories("de.deepsource")
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class Server
{
public static void main (String[] args)
{
log.info("Starting WettkampfDB via MainClass");
SpringApplication.run(Server.class, args);
}
}
Мой ServletInitializer.class
:
@Log4j2
public class ServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure (SpringApplicationBuilder application)
{
log.info("Starting WettkampfDB via SpringBootServletInitializer");
log.debug(application);
return application.sources(Server.class);
}
}
При доступе к localhost: 4000 я получаю Http-Status 500, говорящий: «все экземпляры модуля по умолчанию заняты»
Обновление 1
Я переместил войну на автономный причалместо нахождения.По-прежнему регистрируется, что 2 Spring WebApplicationInitializers detected on classpath
, но Jetty загружает только один экземпляр, который отлично работает на localhost: 8080 / servlet-name
Обновление 2
My build.gradle
buildscript {
ext {
springBootVersion = '2.0.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "com.google.cloud.tools.appengine"
appengine {
run {
port = 4000
}
deploy {
stopPreviousVersion = true
promote = true
}
}
group 'de.deepsource'
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
// Exclude default tomcat server
compile.exclude module: "spring-boot-starter-tomcat"
runtime.exclude module: 'spring-boot-starter-tomcat'
// Exclude default spring logging (replaced with Log4j2)
compile.exclude module: "spring-boot-starter-logging"
compile.exclude group: "org.slf4j", module: "jul-to-slf4j"
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/milestone/" }
}
bootWar {
mainClassName = 'de.deepsource.container.Server'
}
dependencies {
// Spring Boot
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-configuration-processor')
compile("org.springframework.boot:spring-boot-starter-log4j2")
runtime("org.springframework.boot:spring-boot-devtools")
// Google App Engine Dependencies
compile group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starters', version: '1.0.0.M3'
compile group: 'javax.servlet', name: 'javax.servlet-api'
// Runtime provided Servlet Container
// (THIS MUST BE EXCLUDED FOR GOOGLE APP ENGINE DEPLOYS)
//compile('org.springframework.boot:spring-boot-starter-undertow')
// Logger
compile group: 'org.apache.logging.log4j', name: 'log4j-web', version: '2.7'
// Thymeleaf HTML render engine
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity4")
// Model Mapper
compile('org.modelmapper:modelmapper:1.1.1')
compile('org.modelmapper.extensions:modelmapper-spring:1.1.1')
// MapBox Service
compile 'com.mapbox.mapboxsdk:mapbox-java-services:2.1.3'
// OK HTTP client
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.8.1'
// MySQL connector
runtime 'mysql:mysql-connector-java:6.0.5'
// MailJet Client
compile group: 'com.mailjet', name: 'mailjet-client', version: '4.1.1'
// Google Cloud Stuff
runtime 'com.google.cloud.sql:mysql-socket-factory-connector-j-6:1.0.3'
compile 'com.google.apis:google-api-services-monitoring:v3-rev412-1.22.0'
// Google utility library
compile 'com.google.guava:guava:20.0'
// Reduces java boilerplate code
compile "org.projectlombok:lombok:1.16.10"
// Reduces java boilerplate code
compile 'org.apache.commons:commons-lang3:3.7'
// Benchmarking
compile group: 'com.googlecode.log4jdbc', name: 'log4jdbc', version: '1.2'
// JUnit testing framework
testCompile("org.springframework.security:spring-security-test")
testCompile("org.springframework.boot:spring-boot-test")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.boot:spring-boot-test-autoconfigure")
testCompile 'com.google.truth:truth:0.33'
testCompile 'com.google.appengine:appengine-testing:+'
testCompile 'com.google.appengine:appengine-api-stubs:+'
testCompile 'com.google.appengine:appengine-tools-sdk:+'
// JSoup
testCompile group: 'org.jsoup', name: 'jsoup', version: '1.11.3'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.191'
}
Есть идеи как это исправить?