0

类似的问题:当war文件部署到Heroku时Grails出错(工厂方法'requestMappingHandlerAdapter'抛出异常)

但是在将grails 4.0.11生成的war文件部署到Tomcat(v8.5.39)中时,我遇到了它:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.IllegalAccessError: no such method: reactor.core.publisher.Mono.from(Publisher)Mono/invokeStatic
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
        ... 33 more
Caused by: java.lang.BootstrapMethodError: java.lang.IllegalAccessError: no such method: reactor.core.publisher.Mono.from(Publisher)Mono/invokeStatic
        at org.springframework.core.ReactiveAdapterRegistry$ReactorRegistrar.registerAdapters(ReactiveAdapterRegistry.java:194)
        at org.springframework.core.ReactiveAdapterRegistry.<init>(ReactiveAdapterRegistry.java:70)
        at org.springframework.core.ReactiveAdapterRegistry.getSharedInstance(ReactiveAdapterRegistry.java:179)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:169)

我正在从 grails 3.3.11 升级项目。

WAR 正在构建中./gradlew bootWar

本地开发环境开始时没有问题。

我的依赖项build.gradle

    compile 'org.springframework.boot:spring-boot-starter-logging'
    compile 'org.springframework.boot:spring-boot-autoconfigure'
    compile 'org.grails:grails-core'
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    provided 'org.springframework.boot:spring-boot-starter-tomcat'
    compile 'org.grails:grails-web-boot'
    compile 'org.grails:grails-logging'
    compile 'org.grails:grails-plugin-rest'
    compile 'org.grails:grails-plugin-databinding'
    compile 'org.grails:grails-plugin-i18n'
    compile 'org.grails:grails-plugin-services'
    compile 'org.grails:grails-plugin-url-mappings'
    compile 'org.grails:grails-plugin-interceptors'
    compile 'org.grails.plugins:cache'
    compile 'org.grails.plugins:scaffolding'
    compile 'org.grails.plugins:gsp'
    compile 'org.grails:grails-web-fileupload'
    compile 'org.apache.tomcat:tomcat-jdbc'
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.2.4"
    compile "org.grails.plugins:async"
    compile 'com.google.code.gson:gson:2.8.5'
    testCompile 'org.grails:grails-gorm-testing-support'
    testCompile 'org.grails:grails-web-testing-support'
    testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1'
    testRuntime 'net.sourceforge.htmlunit:htmlunit:2.18'
    agent "org.springframework:springloaded:1.2.8.RELEASE"
    runtimeOnly "io.methvin:directory-watcher:0.9.6"
    compileOnly "io.micronaut:micronaut-inject-groovy"
    compile 'org.postgresql:postgresql:42.2.20'
    compile 'org.codehaus.groovy:groovy-dateutil:2.5.14'
    compile 'org.grails.plugins:hibernate5'
    compile 'org.hibernate:hibernate-core:5.4.18.Final'
    compile 'org.hibernate:hibernate-ehcache:5.4.18.Final'
    compile 'org.grails.plugins:spring-security-core:4.0.3'
    compile 'org.grails.plugins:spring-security-acl:4.0.0.M2'
    compile 'org.grails.plugins:postgresql-extensions:7.0.0'
    compile 'org.springframework.security.extensions:spring-security-saml2-core:1.0.3.RELEASE'
    compile 'org.grails.plugins:quartz:2.0.13'
    compile("org.quartz-scheduler:quartz:2.2.3") {
        exclude group: 'slf4j-api', module: 'c3p0'
    }
    compile 'com.google.api-ads:ads-lib:4.2.0'
    compile 'com.google.api-ads:adwords-axis:4.2.0'
    compile "com.googlecode.java-diff-utils:diffutils:1.2.1"
    compile 'net.coobird:thumbnailator:0.4.8'
    compile 'org.apache.ant:ant:1.9.4'
    compile 'commons-io:commons-io:2.5'
    compile 'com.cloudbees.thirdparty:zendesk-java-client:0.6.2'
    compile 'org.yaml:snakeyaml:1.23'
    compile 'cglib:cglib:2.2.2'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'org.apache.pdfbox:pdfbox:1.8.9'
    compile 'commons-validator:commons-validator:1.6'
    compile 'io.fastjson:boon:0.33'
    compile 'com.thoughtworks.xstream:xstream:1.4.8'
    compile 'com.amazonaws:aws-java-sdk-s3:1.11.423'
    compile 'com.amazonaws:aws-java-sdk-core:1.11.423'
    compile 'com.amazonaws:aws-java-sdk-lambda:1.11.423'
    compile 'com.jcraft:jsch:0.1.53'
    compile 'com.opencsv:opencsv:5.2'
    compile project(':common')
    compile project(':query')
    compile project(':query-generator')
    compile 'org.grails.plugins:audit-logging:4.0.3'
    compile 'bouncycastle:bcprov-jdk14:138'
    compile 'org.grails.plugins:csv:1.0'
    compile 'org.grails.plugins:cookie:2.0.5'
    runtime 'org.grails.plugins:grails-console:2.1.1'
    compile 'org.grails.plugins:database-migration:3.1.0'
    compile 'org.liquibase:liquibase-core:3.10.1'
    compile 'org.grails.plugins:qrcode:0.9'
    compile 'org.grails.plugins:mail:3.0.0'
    compile 'org.grails.plugins:grails-executor:0.4'
    compile 'org.reflections:reflections:0.9.10'
    compile 'org.grails.plugins:sentry:11.7.25'
    runtime 'org.jolokia:jolokia-core'
    testRuntime 'net.sourceforge.htmlunit:htmlunit:2.18'
    testRuntime 'org.seleniumhq.selenium:selenium-support:2.53.1'
    testCompile 'org.seleniumhq.selenium:selenium-chrome-driver:2.53.1'
    compile 'org.grails.plugins:views-json:2.0.4'
    testCompile 'org.grails.plugins:greenmail:2.0.0.RC3'
    compile (group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '8.10')
        { exclude group: 'org.ow2.asm' }
    testCompile group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.0'
    compile 'org.codehaus.gpars:gpars:1.1.0'
    testCompile 'org.grails:grails-test-mixins:3.3.0'
    compile 'com.syncron.amazonaws:simba-athena-jdbc-driver:2.0.2'
    testCompile 'org.mock-server:mockserver-netty:5.11.2'
4

1 回答 1

0

我进行了依赖扫描并搜索了任何与反应相关的内容。

它发现反应流是 micronaut 的依赖项。

+--- org.grails:grails-core -> 4.0.10
|    +--- org.codehaus.groovy:groovy:2.5.14
|    +--- org.slf4j:slf4j-api:1.7.30
|    +--- org.slf4j:jcl-over-slf4j:1.7.30
|    |    \--- org.slf4j:slf4j-api:1.7.30
|    +--- io.micronaut:micronaut-inject:1.3.7
|    |    +--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
|    |    +--- javax.annotation:javax.annotation-api:1.3.2
|    |    +--- javax.inject:javax.inject:1
|    |    +--- io.micronaut:micronaut-core:1.3.7
|    |    |    +--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
|    |    |    +--- org.reactivestreams:reactive-streams:1.0.3

排除它解决了问题,但我不知道它可能会导致什么后果。

configurations.all {
    exclude group: 'org.reactivestreams', module: 'reactive-streams'
}

部署到 Tomcat 的war工作正常,该应用程序到目前为止似乎很稳定。

于 2021-07-08T12:25:25.173 回答