spark 1.6 idea本地运行错误

时间:2022-03-28 23:03:36
spark 1.6 idea本地运行错误

将spark maven更新至1.6,运行原有程序,发现以下错误:

java.lang.IllegalArgumentException: System memory  must be at least 4.718592E8. Please use a larger heap size.
at org.apache.spark.memory.UnifiedMemoryManager$.getMaxMemory(UnifiedMemoryManager.scala:)
at org.apache.spark.memory.UnifiedMemoryManager$.apply(UnifiedMemoryManager.scala:)
at org.apache.spark.SparkEnv$.create(SparkEnv.scala:)
at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:)
at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:)
at org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:)
at final_paper_time.main(final_paper_time.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:)
// :: INFO SparkContext: Successfully stopped SparkContext

解决方案:修改运行配置,在VM中增加下述参数:

-Xms128m-Xmx512m-XX:MaxPermSize=300m-ea
spark 1.6 idea本地运行错误