[MAP-58] BuildInfo extractor throws NPE in some cases Created: 30/Aug/15  Updated: 09/Feb/16  Resolved: 03/Nov/15

Status: Resolved
Project: Maven 3 Artifactory Extractor
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.3

Type: Bug Priority: Normal
Reporter: Aviad Shikloshi (Inactive) Assignee: Aviad Shikloshi (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File artifactory_configuration.jpg    
Issue Links:
Relationship
relates to BAP-302 Maven build throws NPE in a specific ... Resolved
Trigger
triggered NMAP-25 The plugin throws NPE in some cases Resolved

 Description   

In some cases when building maven project build info throws NPE from BuildInfoRecorder

org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.builder.BuilderCommon.handleBuildError(BuilderCommon.java:147)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:129)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
build	30-Aug-2015 09:30:06		at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
build	30-Aug-2015 09:30:06		at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
build	30-Aug-2015 09:30:06		at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
build	30-Aug-2015 09:30:06		at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
build	30-Aug-2015 09:30:06		at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
build	30-Aug-2015 09:30:06		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build	30-Aug-2015 09:30:06		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
build	30-Aug-2015 09:30:06		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build	30-Aug-2015 09:30:06		at java.lang.reflect.Method.invoke(Method.java:483)
build	30-Aug-2015 09:30:06		at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
build	30-Aug-2015 09:30:06		at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
build	30-Aug-2015 09:30:06		at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
build	30-Aug-2015 09:30:06		at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
build	30-Aug-2015 09:30:06	Caused by: java.lang.NullPointerException
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.getExtension(BuildInfoRecorder.java:630)
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.addDependenciesToCurrentModule(BuildInfoRecorder.java:614)
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.addFilesToCurrentModule(BuildInfoRecorder.java:478)
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.finalizeAndAddModule(BuildInfoRecorder.java:464)
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.finalizeModule(BuildInfoRecorder.java:392)
build	30-Aug-2015 09:30:06		at org.jfrog.build.extractor.maven.BuildInfoRecorder.projectSucceeded(BuildInfoRecorder.java:210)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:74)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
build	30-Aug-2015 09:30:06		at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:125)
build	30-Aug-2015 09:30:06		... 16 more
build	30-Aug-2015 09:30:06	[ERROR] 
build	30-Aug-2015 09:30:06	[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
build	30-Aug-2015 09:30:06	[ERROR] Re-run Maven using the -X switch to enable full debug logging.
build	30-Aug-2015 09:30:06	[ERROR] 
build	30-Aug-2015 09:30:06	[ERROR] For more information about the errors and possible solutions, please read the following articles:
build	30-Aug-2015 09:30:06	[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException


 Comments   
Comment by Benjamin Dewez [ 01/Oct/15 ]

Hello,

I have the same issue into one of our projects.

It seems that this error is caused by a dependency that is define into a master.

So, if I set this code into my master : (e.g.)

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

The maven build works locally but it throws a stacktrace on Jenkins when it try to launch the "install" phase :

[INFO] — maven-install-plugin:2.4:install (default-install) @ jdsstemplate-admin-master —
...
[ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:142)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:325)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NullPointerException
at org.jfrog.build.extractor.maven.BuildInfoRecorder.getExtension(BuildInfoRecorder.java:610)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.addDependenciesToCurrentModule(BuildInfoRecorder.java:594)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.addFilesToCurrentModule(BuildInfoRecorder.java:460)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.finalizeAndAddModule(BuildInfoRecorder.java:446)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.finalizeModule(BuildInfoRecorder.java:376)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.projectSucceeded(BuildInfoRecorder.java:196)
at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:74)
at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:91)
... 27 more

A workaround for us is "Only use dependencyManagement into a master and don't define a "direct" dependency".
( Disable the artifactory-plugin works also but it's really not helpful for us ^^ )

Our setup :
---------------

Jenkins 1.611
Maven 3.1.1
Artifactory plugin : 2.3.1
Artifactory server : 4.1.0 rev 40011
Maven-install-plugin : 2.4
--------------------------------------------------------------

Thx for your investigation and good luck

Comment by Benjamin Dewez [ 01/Oct/15 ]

Our artifactory-plugin if you want check this part.

Generated at Mon Dec 16 11:47:48 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.