2017-06-19 76 views
1

我這樣的代碼:星火SQL讀取JSON文件從HDFS失敗

val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc) 
import sqlContext.implicits._ 
val customers = sqlContext.read.json("jsonfilepath") 

在火花外殼出現的錯誤,我不明白這一點:?

17/06/19 09:59:04 ERROR bonecp.PoolWatchThread: Error in trying to obtain a connection. Retrying in 7000ms 
java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection. 
     at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) 
     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) 
     at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) 
     at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) 
     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) 
     at org.apache.derby.impl.jdbc.EmbedConnection.setReadOnly(Unknown Source) 
     at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1324) 
     at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:262) 
     at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:115) 
     at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
     at java.lang.Thread.run(Thread.java:745) 
Caused by: ERROR 25505: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection. 
     at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) 
     at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) 
     at org.apache.derby.impl.sql.conn.GenericAuthorizer.setReadOnlyConnection(Unknown Source) 
     at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.setReadOnly(Unknown Source) 
     ... 8 more 

我該如何解決呢謝謝

+0

錯誤信息清楚地說,你需要改變你的數據庫 –

回答

0

爲什麼使用HiveContext來讀取json數據?請使用SOLContext代替。

val sqlContext = new org.apache.spark.sql.SQLContext(sc) 
import sqlContext.implicits._ 
val customers = sqlContext.read.json("jsonfilepath") 
+0

的權限,我想保存數據蜂巢使用HiveContext,SQLContext對我的作品 – shaojie