When I built the es cluster, I used bin/elasticsearch-certutil to generate the CA certificate and p12 certificate, but I did not enter the password, but chose to press Enter directly.
When I want to use spark to connect to es, I find that he needs my es.net.ssl.keystore.pass, I set it to an empty string, but an error is reported. So I'm wondering if there is a default value, or how much I should enter
Hi @gaorui,
What is the error that you're receiving?
Hello. The es I use is version 8.5.3, and the certificate is automatically generated at startup. Here is my configuration:
properties.put("es.net.ssl", "true");
properties.put("es.net.ssl.keystore.location", "file:/mypath/conf/http.p12");
properties.put("es.net.ssl.keystore.pass", "");
properties.put("es.net.ssl.keystore.type", "PKCS12");
This is the error stack displayed by spark:
Exception in thread "main" org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot detect ES version - typically this happens if the network/Elasticsearch cluster is not accessible or when targeting a WAN/Cloud instance without the proper setting 'es.nodes.wan.only'
at org.elasticsearch.hadoop.rest.InitializationUtils.discoverClusterInfo(InitializationUtils.java:403)
at org.elasticsearch.spark.sql.ElasticsearchRelation.cfg$lzycompute(DefaultSource.scala:234)
at org.elasticsearch.spark.sql.ElasticsearchRelation.cfg(DefaultSource.scala:231)
at org.elasticsearch.spark.sql.ElasticsearchRelation.lazySchema$lzycompute(DefaultSource.scala:238)
at org.elasticsearch.spark.sql.ElasticsearchRelation.lazySchema(DefaultSource.scala:238)
at org.elasticsearch.spark.sql.ElasticsearchRelation.$anonfun$schema$1(DefaultSource.scala:242)
at scala.Option.getOrElse(Option.scala:189)
at org.elasticsearch.spark.sql.ElasticsearchRelation.schema(DefaultSource.scala:242)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:434)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:229)
at org.apache.spark.sql.DataFrameReader.$anonfun$load$2(DataFrameReader.scala:211)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:186)
at com.asiainfo.lcims.lcbmi.pcdnanalyze.main.NetFlowTraceBySpark.main(NetFlowTraceBySpark.java:98)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:1020)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:192)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:215)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:91)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:1111)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1120)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: org.elasticsearch.hadoop.EsHadoopIllegalStateException: Cannot initialize SSL - Get Key failed: Cannot read the array length because "password" is null
at org.elasticsearch.hadoop.rest.commonshttp.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:175)
at org.elasticsearch.hadoop.rest.commonshttp.SSLSocketFactory.getSSLContext(SSLSocketFactory.java:160)
at org.elasticsearch.hadoop.rest.commonshttp.SSLSocketFactory.createSocket(SSLSocketFactory.java:129)
at org.elasticsearch.hadoop.thirdparty.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
at org.elasticsearch.hadoop.thirdparty.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
at org.elasticsearch.hadoop.thirdparty.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.elasticsearch.hadoop.thirdparty.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.elasticsearch.hadoop.thirdparty.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at org.elasticsearch.hadoop.rest.commonshttp.CommonsHttpTransport.doExecute(CommonsHttpTransport.java:717)
at org.elasticsearch.hadoop.rest.commonshttp.CommonsHttpTransport.access$200(CommonsHttpTransport.java:98)
at org.elasticsearch.hadoop.rest.commonshttp.CommonsHttpTransport$2.run(CommonsHttpTransport.java:684)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/javax.security.auth.Subject.doAs(Subject.java:439)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1878)
at org.elasticsearch.hadoop.mr.security.HadoopUser.doAs(HadoopUser.java:66)
at org.elasticsearch.hadoop.rest.commonshttp.CommonsHttpTransport.execute(CommonsHttpTransport.java:681)
at org.elasticsearch.hadoop.rest.NetworkClient.execute(NetworkClient.java:116)
at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:442)
at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:438)
at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:406)
at org.elasticsearch.hadoop.rest.RestClient.mainInfo(RestClient.java:755)
at org.elasticsearch.hadoop.rest.InitializationUtils.discoverClusterInfo(InitializationUtils.java:393)
... 26 more
Caused by: java.security.UnrecoverableKeyException: Get Key failed: Cannot read the array length because "password" is null
at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:450)
at java.base/sun.security.util.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:91)
at java.base/java.security.KeyStore.getKey(KeyStore.java:1050)
at java.base/sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:141)
at java.base/sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:64)
at java.base/javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:275)
at org.elasticsearch.hadoop.rest.commonshttp.SSLSocketFactory.loadKeyManagers(SSLSocketFactory.java:217)
at org.elasticsearch.hadoop.rest.commonshttp.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:173)
... 47 more
Caused by: java.lang.NullPointerException: Cannot read the array length because "password" is null
at java.base/sun.security.pkcs12.PKCS12KeyStore$RetryWithZero.run(PKCS12KeyStore.java:259)
at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:361)
... 54 more
Looks like the password cannot be null
Yes the password can't be null so I would recommend setting up a password and checking your settings.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.