Categories

  • articles

Tags

  • java
  • maven

When running a private MAVEN repository via https with self-signed certificate in my case Archiva. You will run into a error when trying to upload/download artifacts.

Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact
Caused by: org.apache.maven.wagon.TransferFailedException: peer not authenticated
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

That solved all my problems.

The problem is you do not have the certificate in your trusted keystore. Your can fix this by importing it using this tool InstallCert. It takes arguments [:port] [passphrase].

It simply copies all the default trusted certificates in jre/lib/security/cacerts and pulls the self-signed certificate from the specified host, into a new file called jssecacerts. This file then needs to be copied to /jre/lib/security/ folder. When java tries to find trust material it will look in order at the following locations:

  1. system property javax.net.ssl.trustStore
  2. java-home/lib/security/jssecacerts
  3. java-home/lib/security/cacerts (shipped by default)

For more info read in the JSSE Reference Guide.