Recently, pyspark is required for the online code, and the error has been reported: py4j.protocol.Py4JJavaError: An error occurred while calling z: org.apache.spark.api.python.PythonRDD.collectAndServe.
I thought it was my own grammatical problem, and it has been fruitless for a long time. Later, it was found that the version of jdk may not be compatible with the spark version. It was solved by changing the version of jdk.