SparkContext.addJar does not work in local mode

后端 未结 1 1912
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 03:32

When there is a jar file needed in a spark job, it needs to be added into spark job through 2 ways:
1. --jar path option in command.
2. SparkConte

1条回答
  •  遥遥无期
    2021-01-20 04:09

    Well, after some research, I found the reason. Just post here if there is someone else involved into this problem.

    Method addJar() does not add jars into driver's classpath. What the method does is to find jars in driver node, distribute into worker nodes and then add into executors' classpath.
    Because I submit my spark job in local mode, driver classpath (I guess) is used in the spark job, the jars added by method addJar() cannot be found.

    In order to solve this problem, use --jars option to include all jars when submit the spark job or use --driver-class-path to add jars.
    More details can be found here.

    0 讨论(0)
提交回复
热议问题