I am trying to follow a tutorial in SparkR. I follow the setup as required. But as soon as I try the function "read.json(path)" I get the following error:
"Error in invokeJava(isStatic = FALSE, objId$id, methodName, ...) :
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)..."
I am running R 3.3.2 and Java JDK 1.8 as requested in the tutorial. I attach images of the code and the results:
Is my Java being found, is it the right version?
The image is in R studio showing the code on the left and the console result on the right:
Solution:
The spark-submit or sparkR instance is there.
Using the hdfs//...path put the json file on the Hadoop hdfs:
Then use
to read the json and create dataframe 'people'.
Above steps worked for me after I made necessary changes in the example dataframe.R.