0

Ok, I have a java 6 project , in mac high sierra, project with a mongo dependency.

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.mongodb:mongo-java-driver:2.14.3'
} 

I get an ssl error when building it using gradle as follows:

FAILURE: Build failed with an exception.

org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':runtime'. ...

Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/2.14.3/mongo-java-driver-2.14.3.pom'. ...

Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)

I tried importing the security certificate into the cacerts but this didn't do it.

#from /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home//lib/security/
openssl s_client -showcerts -connect repo1.maven.org:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mavencert.pem
# from ~
$JAVA_HOME/bin/keytool -import -alias mavencert -keystore cacerts -file $JAVA_HOME/lib/security/mavencert.pem
# enter password: changeit

Upgrading to a never version of java is not a posiblity. Please help.

  • 1
    Possible duplicate of [Peer not authenticated while importing Gradle project in eclipse](https://stackoverflow.com/questions/22887829/peer-not-authenticated-while-importing-gradle-project-in-eclipse) – Pinkie Swirl Aug 16 '18 at 18:57
  • We don't need all those lines of the error message, please edit it down to have only the essential information (Just the first few lines probably). Thanks! – Max von Hippel Aug 16 '18 at 23:36

1 Answers1

1

The connection to https://repo1.maven.org using Java 6 fails because of the Java version you have installed does not support TLS1.2 and repo1.maven.org only supports TLS 1.2 connections.

If you really want to continue using Java 6 you need to install Java SE Development Kit 6, Update 111 or newer.

IMHO you should delete Java 6 (it is outdated and insecure) and install a current Oracle Java version. I assume your version is the one provided by Apple - AFAIK Apple has stopped support for their Java version. Therefore you should no longer use it.

Robert
  • 39,162
  • 17
  • 99
  • 152