How to resolve ‘peer not authenticated’ error during the deployment from Jenkins?

If you are using a certificate for Artifactory’s SSL that is not issued by a well known Certificate Authority, then you will need to trust the SSL certificate’s Root and Intermediate Certificates to certificate stores of both Jenkins and of any application that Jenkins uses. Jenkins Artifactory Plugin can call maven (mvn) to build and deploy artifacts; thus, Artifactory’s Root and Intermediate certificates need to be trusted by it; otherwise, you may decide to specify a path for the certificate store that the mvn should use during the build. For example (see screenshot below), you may declare the certificate store for the mvn by using MAVEN_OPTS section of the Jenkins job, then setting the path to the certificate store by using -Djavax.net.ssl.trustStore={the-path-to-the-certificate-store}

 

Otherwise, you may see following errors during the build:

 

[ERROR] org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: java.lang.RuntimeException: Error occurred while publishing artifact to Artifactory: /app/jenkins/jobs/XXXXX(omitted)XXXX. Skipping deployment of remaining artifacts (if any) and build info.	at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:277)	at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy(BuildDeploymentHelper.java:98)	at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded(BuildInfoRecorder.java:170)	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:64)	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:170)	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:62)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:498)	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:185)	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 hudson.maven.Maven3Builder.call(Maven3Builder.java:136)	at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)	at hudson.remoting.UserRequest.perform(UserRequest.java:120)	at hudson.remoting.UserRequest.perform(UserRequest.java:48)	at hudson.remoting.Request$2.run(Request.java:332)	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)	at java.lang.Thread.run(Thread.java:745)Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated	at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:431)	at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)	at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:437)	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)	at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)	at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)	at org.jfrog.build.client.PreemptiveHttpClient.execute(PreemptiveHttpClient.java:88)	at org.jfrog.build.client.ArtifactoryHttpClient.execute(ArtifactoryHttpClient.java:199)	at org.jfrog.build.client.ArtifactoryHttpClient.upload(ArtifactoryHttpClient.java:195)	at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:618)	at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:329)	at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:275)	... 29 more[ERROR] Internal error: java.lang.RuntimeException: org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: Error occurred while publishing artifact to Artifactory: /app/jenkins/jobs/XXX(Ommitted)