问题描述
我是Spark的新手,我们目前正在使用spark-java从Oracle数据库创建orc文件.我可以使用
I am new to Spark and we are currently using the spark-java to create orc files from Oracle database. I was able to configure the connection with
sqlContext.read().jdbc(url,table,props)
但是,我在属性中找不到任何方法来指定trustStore或trustStoreType.有人可以帮我有关如何指定这些属性吗?
However, I couldn't find any way in the properties to specify the trustStore or trustStoreType. Can someone help me about how to specify these properties?
我已经尝试将属性填充为
I already tried populating the properties as
props.put("trustStore", "<PATH_TO_SSO>");
props.put("trustStoreType", "sso");
但这对我不起作用
Update1:我尝试了user8371915的建议,并将sso文件放置在两个执行器节点中.我仍然遇到以下异常(删节版)
Update1:I have tried what user8371915 has suggested and also placed the sso file in both my executor nodes. I am still getting the following exception (abridged version)
oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:470)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:506)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 23 more
Caused by: oracle.net.ns.NetException: Unable to initialize ssl context.
at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:325)
at oracle.net.nt.TcpsNTAdapter.connect(TcpsNTAdapter.java:117)
at oracle.net.nt.ConnOption.connect(ConnOption.java:159)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:428)
... 28 more
Caused by: oracle.net.ns.NetException: Unable to initialize the trust store.
at oracle.net.nt.CustomSSLSocketFactory.getTrustManagerArray(CustomSSLSocketFactory.java:413)
at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:309)
... 31 more
Caused by: java.security.KeyStoreException: sso not found
at java.security.KeyStore.getInstance(KeyStore.java:851)
at oracle.net.nt.CustomSSLSocketFactory.getTrustManagerArray(CustomSSLSocketFactory.java:401)
... 32 more
Caused by: java.security.NoSuchAlgorithmException: sso KeyStore not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.Security.getImpl(Security.java:695)
at java.security.KeyStore.getInstance(KeyStore.java:848)
... 33 more
推荐答案
首先(信用信息进入 Xephi 此答案)的属性为javax.net.ssl.trustStore
和javax.net.ssl.trustStoreType
.
First of all (credits go to Xephi for this answer) properties are javax.net.ssl.trustStore
and javax.net.ssl.trustStoreType
.
第二个问题是,每个执行者节点上都可以访问trustStore
.不能从驱动程序访问它.
The second problem is that trustStore
should be accessible on each executor node. Being able to access it from the driver is not enought.
这篇关于如何为Spark JDBC连接指定信任存储和信任存储类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!