Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtMaven.run fails with NPE, in jenkins. Using amazoncorretto image to run a project #898

Open
rahulks993 opened this issue Nov 10, 2023 · 6 comments
Labels
question Further information is requested

Comments

@rahulks993
Copy link

rahulks993 commented Nov 10, 2023

Hello,

Our Jenkins build is currently encountering failures on multiple projects, and we're uncertain about the root cause of the issue. Previously, we used OpenJDK images for the builds, but since transitioning to Amazon Corretto, we've been experiencing NullPointerException errors while running on an EC2 Jenkins node. I'd like to provide the versions of Jenkins, Artifactory, Java, and Maven in hopes that someone can assist me in resolving this problem.

Jenkins Artifactory Plugin version: 3.18.0
Jenkins version: Jenkins 2.387.1
Java: amazoncorretto-8
JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
MAVEN_HOME=/usr/share/maven

Jenkins log:

18:29:33  Artifactory integration is enabled
18:29:33  [ion_example-library-maven_master@2] $ docker exec --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** 72bb62edf48f47bb7492abb6ddb173ce0d7c4ea6fec8abef41b086f6c1037686 /usr/lib/jvm/java-1.8.0-amazon-corretto/bin/java -classpath /usr/share/maven/boot/* -Dmaven.home=/usr/share/maven -Dmaven.conf=/usr/share/maven/conf -DbuildInfoConfig.propertiesFile=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/buildInfo10368569271467580023.properties -Dm3plugin.lib=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/cache/artifactory-plugin/3.18.0 -Dclassworlds.conf=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2@tmp/artifactory/classworlds17219468755132725245conf -Dmaven.multiModuleProjectDirectory=/opt/appadmin/buildroot/workspace/ion_example-library-maven_master@2 org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml clean install -Dmaven.test.skip=true

18:29:33  SLF4J: Actual binding is of type [org.slf4j.impl.MavenSimpleLoggerFactory]
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
18:29:35  [main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------< example-library-maven >-------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building example-library-maven 1.0.4-SNAPSHOT
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger -   from pom.xml
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ jar ]---------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time:  0.226 s
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2023-11-09T12:59:35Z
18:29:35  [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - NullPointerException
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - 
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
18:29:35  [main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
18:29:35  ERROR: Couldn't execute Maven task. RuntimeException: Maven build failed with exit code 1

java.lang.RuntimeException: Maven build failed with exit code 1
	at org.jfrog.hudson.pipeline.common.Utils.launch(Utils.java:280)
Caused: java.lang.RuntimeException: Maven build failed. Couldn't execute Maven task. RuntimeException: Maven build failed with exit code 1
	at org.jfrog.hudson.pipeline.common.Utils.launch(Utils.java:285)
	at org.jfrog.hudson.maven3.Maven3Builder.RunMaven(Maven3Builder.java:121)
	at org.jfrog.hudson.maven3.Maven3Builder.perform(Maven3Builder.java:116)
	at org.jfrog.hudson.pipeline.common.executors.MavenExecutor.execute(MavenExecutor.java:72)
	at org.jfrog.hudson.pipeline.scripted.steps.ArtifactoryMavenBuild$Execution.runStep(ArtifactoryMavenBuild.java:65)
	at org.jfrog.hudson.pipeline.scripted.steps.ArtifactoryMavenBuild$Execution.runStep(ArtifactoryMavenBuild.java:51)
	at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:55)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	

It fails while running this piece of code:
server = Artifactory.server 'Artifactory Pro'
rtMaven = Artifactory.newMavenBuild()
rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server
rtMaven.deployer.deployArtifacts = false
buildInfo = Artifactory.newBuildInfo()
rtMaven.run pom: 'pom.xml', goals: 'clean install -Dmaven.test.skip=true', buildInfo: buildInfo

@rahulks993 rahulks993 added the question Further information is requested label Nov 10, 2023
@rahulks993
Copy link
Author

@yahavi Could you please help me here?

@yahavi
Copy link
Member

yahavi commented Nov 10, 2023

Hey @rahulks993,
You're using a version that was released almost a year ago.
Any possibility you could think about upgrading to the latest release and inform us if that resolves the issue?

@rahulks993
Copy link
Author

@yahavi The most recent release of Artifactory is 4.0.0. Nevertheless, I'd appreciate your recommendation on which version I should proceed with. For instance, should I opt for version 3.18.1 or 3.18.3? I came across an issue that appears to have logs closely resembling my own situation.

@yahavi
Copy link
Member

yahavi commented Nov 10, 2023

@rahulks993
The problem raised in #734 got resolved through jfrog/build-info#714 in version 3.18.4.

If there are Gradle jobs in your Jenkins instance utilizing Gradle versions below 6.8.1, you have the option to upgrade to the latest v3 version, 3.18.12. Otherwise, consider upgrading to the latest major, 4.0.0.

By the way, we've introduced a JFrog CLI-based JFrog plugin that can operate alongside the traditional Artifactory plugin. The JFrog CLI is among the favored tools in the community, and I suggest opting for it over the older Jenkins plugin.

@rahulks993
Copy link
Author

rahulks993 commented Nov 10, 2023

@yahavi I'll try upgrading to 3.18.4 or 3.18.12 and I'll confirm you back whether the issue which we are facing is resolved or not. If it doesn't then I'll consider upgrading to 4.0.0 . However we are not having gradle jobs in our jenkins instance we are still using maven.

@rahulks993
Copy link
Author

rahulks993 commented Nov 10, 2023

@yahavi Thanks for your recommendation, the issue is resolved now with 3.18.4. You may close this question now

@rahulks993 rahulks993 reopened this Nov 13, 2023
@yahavi yahavi linked a pull request Jan 14, 2024 that will close this issue
3 tasks
@yahavi yahavi removed a link to a pull request Jan 14, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants