mavenpactsslhandshakeexception

SSLHandshakeException in mvnw verify


I'm trying to build pact-workshop-Maven-Springboot-JUnit5/tree/step1 but getting this error when I run command "mvnw verify":

C:\Users\MyUser\git\pact-workshop-Maven-Springboot-JUnit5\consumer>mvnw verify
Found "C:\Users\MyUser\git\pact-workshop-Maven-Springboot-JUnit5\consumer\.mvn\wrapper\maven-wrapper.jar"
JRE being used (logged by my modification in mvnw.cmd): "C:\Program Files (x86)\Java\jre7\bin\java.exe"
Takari Maven Wrapper 0.5.6
Downloading Maven binary from https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
Downloading https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip

Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:90)
    at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:76)
    at org.apache.maven.wrapper.Installer.createDist(Installer.java:72)
    at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
    at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)

I've already added the certificate of Maven Repo to the cacerts file "C:\Program Files (x86)\Java\jre7\lib\security\cacerts". Here is its entry in cacerts:

C:\WINDOWS\system32>"C:\Program Files (x86)\Java\jre7\bin\keytool.exe" -list -keystore "C:\Program Files (x86)\Java\jre7\lib\security\cacerts"
Enter keystore password:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 79 entries

apachemaven, 14.Eyl.2022, trustedCertEntry,
Certificate fingerprint (SHA1): 5E:9A:A9:4B:5A:8A:1C:31:DB:1F:B5:E6:CF:E4:4D:B1:4C:AE:2F:5F

What am I missing?


Solution

  • Maven Central repository support only TLS 1.2 - more info

    By the way mentioned project require JDK 1.8, so you must use JDK 1.8 at least - not 1.7.

    With JDK 1.8 your problem will disappear.