gpt4 book ai didi

java.lang.NullPointerException : Cannot invoke "java.net.URL.toExternalForm()" because "resource" is null at org. mapstruct

转载 作者:行者123 更新时间:2023-12-04 14:33:54 30 4
gpt4 key购买 nike

使用 Idea 进行 mvn 编译工作正常。
在 App.main 启动期间失败。
在 Ubuntu 上的其他 PC 上的旧 Idea 上运行良好。
环境:

  • Intellij 2020.3.2 作为管理员;
  • Java 15.02;
  • 视窗 10 x64;
  • 最新的 map 结构。

  • 如何解决这个问题?
    D:\back\src\main\java\io\x\mapper\Mapper.java:15:8 java: Internal error in the mapping processor: java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "resource" is null
    at org.mapstruct.ap.internal.processor.DefaultVersionInformation.createManifestUrl(DefaultVersionInformation.java:182)
    at org.mapstruct.ap.internal.processor.DefaultVersionInformation.openManifest(DefaultVersionInformation.java:153)
    at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getLibraryName(DefaultVersionInformation.java:129)
    at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getCompiler(DefaultVersionInformation.java:122)
    at org.mapstruct.ap.internal.processor.DefaultVersionInformation.fromProcessingEnvironment(DefaultVersionInformation.java:95)
    at org.mapstruct.ap.internal.processor.DefaultModelElementProcessorContext.<init>(DefaultModelElementProcessorContext.java:50)
    at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:218)
    at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:156)
    at jdk.internal.reflect.GeneratedMethodAccessor207.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.jetbrains.jps.javac.APIWrappers$1.invoke(APIWrappers.java:248)
    at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.process(Unknown Source)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1025)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:940)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1269)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1383)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1261)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:935)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
    at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
    at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231)
    at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501)
    at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353)
    at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277)
    at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)
    at org.jetbrains.jps.incremental.IncProjectBuilder.access$1200(IncProjectBuilder.java:67)
    at org.jetbrains.jps.incremental.IncProjectBuilder$BuildParallelizer$1.run(IncProjectBuilder.java:1006)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)

    最佳答案

    我在 Intellij 20.3.2 中遇到 MapStruct 问题。错误 映射处理器中的内部错误:java.lang.NullPointerException:无法调用“java.net.URL.toExternalForm()”,因为“资源”为空[...]。
    我做了一些研究,发现只需更改 pom.xml 中的版本就足够了。在文档网站上我们可以看到包安装配置:https://mapstruct.org/documentation/installation/
    以下摘录仍然有错误:

      <groupId>org.mapstruct</groupId>

    <artifactId>mapstruct</artifactId>

    <version>**${org.mapstruct.version}**</version>

    最后,将以下版本放入 1.4.2.最终顺利运行​​应用程序。

    关于java.lang.NullPointerException : Cannot invoke "java.net.URL.toExternalForm()" because "resource" is null at org. mapstruct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66591176/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com