1
這裏是我的build.gradle
春天開機webflux應用程序將無法啓動IllegalStateException異常
buildscript {
ext {
springBootVersion = '2.0.0.M2'
}
repositories {
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-security',
'org.springframework.boot:spring-boot-starter-mail',
'org.springframework.boot:spring-boot-starter-validation',
'org.springframework.boot:spring-boot-starter-webflux',
// support libs
'commons-io:commons-io:2.5',
'commons-codec:commons-codec:1.10',
'org.apache.commons:commons-lang3:3.4',
'org.apache.commons:commons-collections4:4.1',
//validation
'javax.validation:validation-api:1.1.0.Final'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor',
'org.projectlombok:lombok'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
當我試圖用java.lang.IllegalStateException: java.lang.NullPointerException
堆棧跟蹤運行的應用程序失敗:通過開始產生
java.lang.IllegalStateException: java.lang.NullPointerException
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.stopAndReleaseReactiveWebServer(ReactiveWebServerApplicationContext.java:152) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:52) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at com.getcredit.bankscraper.Application.main(Application.java:10) [main/:na]
Caused by: java.lang.NullPointerException: null
at org.springframework.boot.web.embedded.netty.NettyWebServer.stop(NettyWebServer.java:113) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.stopAndReleaseReactiveWebServer(ReactiveWebServerApplicationContext.java:148) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
... 7 common frames omitted
項目。 spring.io網站。
你可以發佈代碼,在哪裏創建你的netty服務器和處理器適配器 –
當你切換到'2.0.0.M1' Spring Boot時,你有同樣的問題嗎? – ledniov
不幸的是,NullPointerException掩蓋了實際的失敗。如果你在'ReactiveWebServerApplicationContext'的第52行用一個斷點調試你的應用程序(https://github.com/spring-projects/spring-boot/blob/v2.0.0.M2/spring-boot/src/main/ java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java#L52)你應該能夠看到什麼導致你的應用程序無法啓動 –