2016-06-06 109 views
1

我試圖從Bluemix Spark上的iPython筆記本作爲服務連接BigSQL Cloud上的BigSQL羣集。消息:RSA premaster祕密錯誤。 ERRORCODE = -4499,SQLSTATE = 08001

我的筆記本電腦看起來是這樣的:

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連接時,一個類似的錯誤。

+0

根據該[答案](https://developer.ibm.com/answers/ questions/206325/how-to-fix-this-ssl-error-javaxnetsslsslkeyexcepti.html),似乎需要在spark服務上安裝無限制的管轄權策略文件。 –

回答

0

現在已經修復。

有關示例的筆記本,在這裏看到:

enter image description here

筆記本電腦是在可用的GitHub here

1

我發現根據您找到的link的說明,需要在java目錄下的spark服務上安裝無限管轄權策略文件。 在上bluemix用戶火花服務租戶不同意創建/瀏覽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 

這已經注意到作爲一項要求,並作進一步調查將進行審查(鎖定)。

謝謝, Charles。

相關問題