gradle 升级jdk版本8到11,并将模型Map插件更新到2.3.9后,仍然面临模型Map异常

7xzttuei  于 2023-04-21  发布在  其他
关注(0)|答案(1)|浏览(88)
Exception Message: org.modelmapper.MappingException: ModelMapper mapping errors:1) Error mapping
  at org.modelmapper.internal.Errors.throwMappingExceptionIfErrorsExist(Errors.java:380)
  at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:81)
  at org.modelmapper.ModelMapper.mapInternal(ModelMapper.java:573)
  at org.modelmapper.ModelMapper.map(ModelMapper.java:406)
  at rest.translator.impl.MongoDbDocumentTranslatorImpl.toResponse(MongoDbDocumentTranslatorImpl.java:214)
  at rest.translator.impl.MongoDbDocumentTranslatorImpl.translate(MongoDbDocumentTranslatorImpl.java:200)
  at rest.translator.impl.UserInformationTranslatorImpl.translate(UserInformationTranslatorImpl.java:38)
  at rest.controller.UserController.lambda$getAll$1(UserController.java:106)
  at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
  at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
  at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)...

我尝试更新模型Map插件。它不工作。
在Local中,getAll端点似乎正在工作。
在环境服务器级别,由于模型Map器异常而失败。
这些是以下依赖项:

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    compile 'org.springframework.boot:spring-boot-starter-data-mongodb'
    compile 'org.springframework.boot:spring-boot-starter-security'
    compile 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.0.M4'
    compile 'org.springframework.boot:spring-boot-starter-log4j2'
    compile 'org.springframework.security:spring-security-oauth2-resource-server'
    compile 'org.springframework.security:spring-security-oauth2-jose'
    compile 'org.springframework.security:spring-security-config'
    compile 'org.springframework.retry:spring-retry'
    compile 'org.springframework.boot:spring-boot-starter-cache'
    compile 'org.springframework.boot:spring-boot-starter-data-redis'
    compile('org.springframework.boot:spring-boot-starter-web') {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    }
    compile 'io.micrometer:micrometer-registry-prometheus'

    compile 'com.nimbusds:oauth2-oidc-sdk:7.1.1'

    compile 'io.springfox:springfox-swagger2:2.9.2'
    compile 'io.springfox:springfox-swagger-ui:2.9.2'
    compile 'io.springfox:springfox-bean-validators:2.9.2'
    compile "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.22.1"
    compile "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
    compile 'org.apache.commons:commons-lang3:3.0'
    compile 'commons-io:commons-io:2.6'
    compile 'org.aspectj:aspectjweaver'
    compile 'org.modelmapper:modelmapper:2.3.9'
    compile 'com.amazonaws:aws-java-sdk-s3:1.11.797'
    compile 'com.amazonaws:aws-java-sdk-core:1.11.797'
    compile 'org.assertj:assertj-core:3.6.2'
    runtime 'org.springframework.boot:spring-boot-starter-tomcat'
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'org.springframework.security:spring-security-test'
    testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
    testCompile 'de.bwaldvogel:mongo-java-server:1.16.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
    testCompile group: 'io.findify', name: 's3mock_2.12', version: '0.2.6'
    compile 'io.cucumber:cucumber-java:4.5.3'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '2.4.2'
    compileOnly "org.springframework.boot:spring-boot-configuration-processor"
    // jdk 11 migration dependencies
    implementation "javax.xml.bind:jaxb-api:2.3.1"
    implementation "com.sun.xml.bind:jaxb-core:2.3.0.1"
    implementation "com.sun.xml.bind:jaxb-impl:2.3.1"
    implementation "com.sun.activation:javax.activation:1.2.0"
    implementation("javax.annotation:javax.annotation-api:1.3.2")
    compile group: 'org.ow2.asm', name: 'asm', version: '7.1'
    testCompile("javax.xml.ws:jaxws-api:2.3.1")
    implementation 'org.springframework.boot:spring-boot-test'
    implementation 'org.springframework.boot:spring-boot-test-autoconfigure'
    // end of jdk 11 migration dependencies
}

modelmapper 2.4.0也会导致相同的异常。
什么是可能的修复!!?

myzjeezk

myzjeezk1#

已通过将org.springframework.boot依赖项的版本从2.2.4.RELEASE升级到2.2.11.RELEASE来解决此错误,这也更新了spring.data.mongodb.core依赖项的版本。
此更新修复了模型Map的问题,该问题是由先前版本的spring.data.mongodb.core依赖项引起的。

相关问题