lhy1111112 2023-03-28 21:48 采纳率: 33.3%
浏览 84
已结题

Exception in thread "main" org.apache.spark.SparkException

img


**spark-submit的命令问题
Exception in thread "main" org.apache.spark.SparkException:Failed to get main class in JAR with error"file:/opt/module/spark-3.2.1/wordCount/opt/module/spark-3.2.1/word.jar does not exist'. Please specify one with --class."

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-03-29 06:11
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:
    • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/688355
    • 你也可以参考下这篇文章:spark-submit以集群方式提交应用报错:Exception in thread "main" java.sql.SQLException: No suitable driver
    • 除此之外, 这篇博客: 【3天掌握Spark】-- IDEA 应用开发Spark中的 Spark 应用提交命令【spark-submit】 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

      使用IDEA集成开发工具开发测试Spark Application程序以后,类似MapReduce程序一样,打成jar包,使用命令【spark-submit】提交应用的执行

      [root@node1 ~]# /export/server/spark/bin/spark-submit --help
      Usage: spark-submit [options] <app jar | python file | R file> [app arguments]
      Usage: spark-submit --kill [submission ID] --master [spark://...]
      Usage: spark-submit --status [submission ID] --master [spark://...]
      Usage: spark-submit run-example [options] example-class [example args]
      
      Options:
        --master MASTER_URL         spark://host:port, mesos://host:port, yarn,
                                    k8s://https://host:port, or local (Default: local[*]).
        --deploy-mode DEPLOY_MODE   Whether to launch the driver program locally ("client") or
                                    on one of the worker machines inside the cluster ("cluster")
                                    (Default: client).
        --class CLASS_NAME          Your application's main class (for Java / Scala apps).
        --name NAME                 A name of your application.
        --jars JARS                 Comma-separated list of jars to include on the driver
                                    and executor classpaths.
        --packages                  Comma-separated list of maven coordinates of jars to include
                                    on the driver and executor classpaths. Will search the local
                                    maven repo, then maven central and any additional remote
                                    repositories given by --repositories. The format for the
                                    coordinates should be groupId:artifactId:version.
        --exclude-packages          Comma-separated list of groupId:artifactId, to exclude while
                                    resolving the dependencies provided in --packages to avoid
                                    dependency conflicts.
        --repositories              Comma-separated list of additional remote repositories to
                                    search for the maven coordinates given with --packages.
        --py-files PY_FILES         Comma-separated list of .zip, .egg, or .py files to place
                                    on the PYTHONPATH for Python apps.
        --files FILES               Comma-separated list of files to be placed in the working
                                    directory of each executor. File paths of these files
                                    in executors can be accessed via SparkFiles.get(fileName).
      
        --conf PROP=VALUE           Arbitrary Spark configuration property.
        --properties-file FILE      Path to a file from which to load extra properties. If not
                                    specified, this will look for conf/spark-defaults.conf.
      
        --driver-memory MEM         Memory for driver (e.g. 1000M, 2G) (Default: 1024M).
        --driver-java-options       Extra Java options to pass to the driver.
        --driver-library-path       Extra library path entries to pass to the driver.
        --driver-class-path         Extra class path entries to pass to the driver. Note that
                                    jars added with --jars are automatically included in the
                                    classpath.
      
        --executor-memory MEM       Memory per executor (e.g. 1000M, 2G) (Default: 1G).
      
        --proxy-user NAME           User to impersonate when submitting the application.
                                    This argument does not work with --principal / --keytab.
      
        --help, -h                  Show this help message and exit.
        --verbose, -v               Print additional debug output.
        --version,                  Print the version of current Spark.
      
       Cluster deploy mode only:
        --driver-cores NUM          Number of cores used by the driver, only in cluster mode
                                    (Default: 1).
      
       Spark standalone or Mesos with cluster deploy mode only:
        --supervise                 If given, restarts the driver on failure.
        --kill SUBMISSION_ID        If given, kills the driver specified.
        --status SUBMISSION_ID      If given, requests the status of the driver specified.
      
       Spark standalone and Mesos only:
        --total-executor-cores NUM  Total cores for all executors.
      
       Spark standalone and YARN only:
        --executor-cores NUM        Number of cores per executor. (Default: 1 in YARN mode,
                                    or all available cores on the worker in standalone mode)
      
       YARN-only:
        --queue QUEUE_NAME          The YARN queue to submit to (Default: "default").
        --num-executors NUM         Number of executors to launch (Default: 2).
                                    If dynamic allocation is enabled, the initial number of
                                    executors will be at least NUM.
        --archives ARCHIVES         Comma separated list of archives to be extracted into the
                                    working directory of each executor.
        --principal PRINCIPAL       Principal to be used to login to KDC, while running on
                                    secure HDFS.
        --keytab KEYTAB             The full path to the file that contains the keytab for the
                                    principal specified above. This keytab will be copied to
                                    the node running the Application Master via the Secure
                                    Distributed Cache, for renewing the login tickets and the
                                    delegation tokens periodically.
      

      提交一个应用命令:

      Usage: spark-submit [options] <app jar | python file | R file> [app arguments]

      第一种:基本参数配置
      在这里插入图片描述
      第二种:Driver Program 参数配置
      在这里插入图片描述
      第三种:Executor 参数配置
      每个Spark Application运行时,需要启动Executor运行任务Task,需要指定Executor个数及每个Executor资源信息(内存Memory和CPU Core核数)。
      在这里插入图片描述


    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 6月22日
  • 已采纳回答 6月14日
  • 创建了问题 3月28日

悬赏问题

  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao