When I started spark-shell by the following command
bin/spark-shell --packages org.apache.bahir:spark-streaming-mqtt_2.11:2.3.0 --repositories http://central.maven.org/maven2/org/apache/bahir/spark-streaming-mqtt_2.11/2.3.0/
Two errors were occurred.
Server access error at url https://central.maven.org/org/apache/bahir/bahir-parent_2.11/2.3.2/bahir-parent_2.11-2.3.2.jar (javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching central.maven.org found.)
and
Server access error at url https://central.maven.org/org/apache/bahir/spark-streaming-mqtt_2.11/2.3.2/spark-streaming-mqtt_2.11-2.3.2-javadoc.jar (javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching central.maven.org found.)
Here I gave repository as http://central.maven.org/maven2/org/apache/bahir/spark-streaming-mqtt_2.11/2.3.0/ But it automatically connect to https://central.maven.org/org/apache/bahir/bahir-parent_2.11/2.3.2/bahir-parent_2.11-2.3.2.jar which is not present in internet.
How to add these two modules in my spark-shell? My aim is to build a spark-streaming mqtt application, which handles multiple topics.
It would be issue with your system. Regarding the error related, there many reasons which causes
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException
. One of reason would be due to the mismatch between the request host URL (which includes the IP address) and the certificate (which usually includes a DNS hostname), the request fails.This is caused by the fact that the certificate is missing aliases (subject alternative names) for the host when the server is accessed with a different name from the default one.The problem can be resolved in a number of ways. Please find some alternatives in the below links:
https://support.mulesoft.com/s/article/CertificateException-No-Subject-Alternative-Names-Present
https://support.cloudbees.com/hc/en-us/articles/360017693231-Why-am-I-getting-No-subject-alternative-DNS-name-matching-XXX-when-connecting-through-ldaps-
https://confluence.atlassian.com/confkb/java-security-cert-certificateexception-no-subject-alternative-dns-name-matching-hostname-found-452100730.html
https://confluence.atlassian.com/jirakb/java-security-cert-certificateexception-no-subject-alternative-dns-name-matching-hostname-found-297669411.html
I am able to add modules to Spark-Shell.Please find snippet as below.