程序运行报错分享

问题

java: Internal error in the mapping processor: java.lang.NullPointerException 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.(DefaultModelElementProcessorContext.java:50) at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:218) at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:156) at org.jetbrains.jps.javac.APIWrappers$ProcessorWrapper.process(APIWrappers.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jetbrains.jps.javac.APIWrappers$1.invoke(APIWrappers.java:313) at org.mapstruct.ap.MappingProcessor.process(Unknown Source) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705) at com.sun.tools.javac.processing.JavacProcessingEnvironment.access 1800 ( J a v a c P r o c e s s i n g E n v i r o n m e n t . j a v a : 91 ) a t c o m . s u n . t o o l s . j a v a c . p r o c e s s i n g . J a v a c P r o c e s s i n g E n v i r o n m e n t 1800(JavacProcessingEnvironment.java:91) at com.sun.tools.javac.processing.JavacProcessingEnvironment 1800(JavacProcessingEnvironment.java:91)atcom.sun.tools.javac.processing.JavacProcessingEnvironmentRound.run(JavacProcessingEnvironment.java:1035) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) at com.sun.tools.javac.main.Main.compile(Main.java:523) at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:238) at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava 2 ( J a v a B u i l d e r . j a v a : 519 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . j a v a . J a v a B u i l d e r . i n v o k e J a v a c ( J a v a B u i l d e r . j a v a : 565 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . j a v a . J a v a B u i l d e r . c o m p i l e J a v a ( J a v a B u i l d e r . j a v a : 517 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . j a v a . J a v a B u i l d e r . c o m p i l e ( J a v a B u i l d e r . j a v a : 360 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . j a v a . J a v a B u i l d e r . d o B u i l d ( J a v a B u i l d e r . j a v a : 285 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . j a v a . J a v a B u i l d e r . b u i l d ( J a v a B u i l d e r . j a v a : 239 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . r u n M o d u l e L e v e l B u i l d e r s ( I n c P r o j e c t B u i l d e r . j a v a : 1519 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . r u n B u i l d e r s F o r C h u n k ( I n c P r o j e c t B u i l d e r . j a v a : 1149 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . b u i l d T a r g e t s C h u n k ( I n c P r o j e c t B u i l d e r . j a v a : 1299 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . b u i l d C h u n k I f A f f e c t e d ( I n c P r o j e c t B u i l d e r . j a v a : 1114 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . b u i l d C h u n k s ( I n c P r o j e c t B u i l d e r . j a v a : 885 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . r u n B u i l d ( I n c P r o j e c t B u i l d e r . j a v a : 467 ) a t o r g . j e t b r a i n s . j p s . i n c r e m e n t a l . I n c P r o j e c t B u i l d e r . b u i l d ( I n c P r o j e c t B u i l d e r . j a v a : 197 ) a t o r g . j e t b r a i n s . j p s . c m d l i n e . B u i l d R u n n e r . r u n B u i l d ( B u i l d R u n n e r . j a v a : 150 ) a t o r g . j e t b r a i n s . j p s . c m d l i n e . B u i l d S e s s i o n . r u n B u i l d ( B u i l d S e s s i o n . j a v a : 348 ) a t o r g . j e t b r a i n s . j p s . c m d l i n e . B u i l d S e s s i o n . r u n ( B u i l d S e s s i o n . j a v a : 175 ) a t o r g . j e t b r a i n s . j p s . c m d l i n e . B u i l d M a i n 2(JavaBuilder.java:519) at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:565) at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:517) at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:360) at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:285) at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:239) at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1519) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1149) at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1299) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1114) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:885) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:467) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:197) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:150) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:348) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:175) at org.jetbrains.jps.cmdline.BuildMain 2(JavaBuilder.java:519)atorg.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:565)atorg.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:517)atorg.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:360)atorg.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:285)atorg.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:239)atorg.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1519)atorg.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1149)atorg.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1299)atorg.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1114)atorg.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:885)atorg.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:467)atorg.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:197)atorg.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:150)atorg.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:348)atorg.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:175)atorg.jetbrains.jps.cmdline.BuildMainMyMessageHandler.lambda$channelRead0 0 ( B u i l d M a i n . j a v a : 218 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1149 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r 0(BuildMain.java:218) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor 0(BuildMain.java:218)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

原因

项目中使用了mapstruct框架,在使用Idea新版本后,启动会报错!

解决办法

  1. idea加启动参数
    修改Setting -->Build,Execution,Deployment -->Compiler -->User-local build process VM options (overrides Shared options):
    加入参数
-Djps.track.ap.dependencies=false

在这里插入图片描述

  1. mapstruct框架引入版本升至1.4.1.Final或更高版本

建议

mapstruct经常有问题,建议弃用,性能再好但是不稳定也是尴尬

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐