消息:RSA premaster secret error。 ERRORCODE = -4499,SQLSTATE = 08001

时间:2016-06-06 21:01:34

标签: apache-spark ibm-cloud pyspark biginsights bigsql

我正试图通过Bluemix Spark上的iPython笔记本连接到BigInsights on Cloud集群上的BigSQL作为服务。

我的笔记本看起来像这样:

import os
cwd = os.getcwd()

with open('certificate', 'w') as f:
    f.write('''-----BEGIN CERTIFICATE-----
XXXXXXXXXXXXXXX
-----END CERTIFICATE-----''')

!rm truststore.jks
!keytool -import -trustcacerts -alias biginsights -file certificate -keystore truststore.jks -storepass mypassword -noprompt

host = 'ehaasp-xxxxx-master-2.bi.services.bluemix.net'
user = 'biadmin'
pwd  = 'xxxxxxx'
url  = 'jdbc:db2://{0}:51000/bigsql:user={1};password={2};sslConnection=true;sslTrustStoreLocation={3}/truststore.jks;Password=mypassword;'.format(host, user, pwd, cwd)

df = sqlContext.read.format('jdbc').options(url=url,
         driver='com.ibm.db2.jcc.DB2Driver', dbtable='GOSALESDW.SLS_SALES_FACT').load()

我收到的例外是:

Py4JJavaError: An error occurred while calling o111.load.
: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2030][11211][4.19.26] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: Reply.fill() - socketInputStream.read (-1).  Message: RSA premaster secret error. ERRORCODE=-4499, SQLSTATE=08001
    at com.ibm.db2.jcc.am.kd.a(Unknown Source)
    at com.ibm.db2.jcc.t4.a.a(Unknown Source)
    at com.ibm.db2.jcc.t4.a.a(Unknown Source)
    at com.ibm.db2.jcc.t4.a.a(Unknown Source)
    at com.ibm.db2.jcc.t4.a.b(Unknown Source)
    at com.ibm.db2.jcc.t4.a.a(Unknown Source)
    at com.ibm.db2.jcc.t4.a.f(Unknown Source)
    at com.ibm.db2.jcc.t4.a.flush_(Unknown Source)
    at com.ibm.db2.jcc.am.Agent.flowOutsideUOW(Unknown Source)
    at com.ibm.db2.jcc.t4.b.b(Unknown Source)
    at com.ibm.db2.jcc.t4.b.b(Unknown Source)
    at com.ibm.db2.jcc.t4.b.a(Unknown Source)
    at com.ibm.db2.jcc.t4.b.a(Unknown Source)
    at com.ibm.db2.jcc.t4.b.a(Unknown Source)
    at com.ibm.db2.jcc.t4.b.<init>(Unknown Source)
    at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
    at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
    at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
    at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:583)
    at java.sql.DriverManager.getConnection(DriverManager.java:199)
    at org.apache.spark.sql.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:118)
    at org.apache.spark.sql.jdbc.JDBCRelation.<init>(JDBCRelation.scala:128)
    at org.apache.spark.sql.jdbc.DefaultSource.createRelation(JDBCRelation.scala:113)
    at org.apache.spark.sql.sources.ResolvedDataSource$.apply(ddl.scala:269)
    at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:114)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
    at java.lang.reflect.Method.invoke(Method.java:620)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379)
    at py4j.Gateway.invoke(Gateway.java:259)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:207)
    at java.lang.Thread.run(Thread.java:801)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
    at com.ibm.jsse2.z.<init>(z.java:85)
    at com.ibm.jsse2.B.a(B.java:20)
    at com.ibm.jsse2.B.a(B.java:275)
    at com.ibm.jsse2.A.t(A.java:225)
    at com.ibm.jsse2.A.a(A.java:452)
    at com.ibm.jsse2.aq.a(aq.java:30)
    at com.ibm.jsse2.aq.h(aq.java:790)
    at com.ibm.jsse2.aq.a(aq.java:371)
    at com.ibm.jsse2.h.write(h.java:20)
    at com.ibm.db2.jcc.t4.eb.b(Unknown Source)
    at com.ibm.db2.jcc.t4.eb.a(Unknown Source)
    ... 31 more
Caused by: java.security.InvalidKeyException: Illegal key size or default parameters
    at javax.crypto.Cipher.a(Unknown Source)
    at javax.crypto.Cipher.a(Unknown Source)
    at javax.crypto.Cipher.a(Unknown Source)
    at javax.crypto.Cipher.init(Unknown Source)
    at com.ibm.jsse2.z.<init>(z.java:122)
    ... 41 more

尝试使用Hive 2.0 jdbc进行连接时出现类似错误。

2 个答案:

答案 0 :(得分:1)

我看到根据您找到的link的说明,需要在java目录下的spark服务上安装无限管辖区域策略文件。 在bluemix用户的spark服务租户下,不能创建/浏览java目录。(锁定)

n [4]:
!echo $JAVA_HOME
/usr/local/src/spark160master/ibm-java-x86_64-80
In [5]:
!ls $JAVA_HOME/Security/
ls: cannot access /usr/local/src/spark160master/ibm-java-x86_64-80/Security/: No such file or directory
In [6]:
!touch $JAVA_HOME/Security/policydummy.txt
touch: cannot touch '/usr/local/src/spark160master/ibm-java-x86_64-80/Security/policydummy.txt': No such file or directory

这已被视为一项要求,将进行审查以供进一步调查。

谢谢, 查尔斯。

答案 1 :(得分:0)

现在已经修复了。

有关示例笔记本,请参阅此处:

enter image description here

该笔记本可在GitHub here

中找到