无法从JAR文件加载主类 [英] Cannot load main class from JAR file

查看:172
本文介绍了无法从JAR文件加载主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序Spark-scala,我试图显示一条简单的消息"Hello my App".当我用sbt编译它很好时,我也用sbt运行它很好,我成功显示了我的消息,但他显示了一个错误;像这样:

I have an application Spark-scala, I tried to dispaly a simple message "Hello my App". when I compile it by sbt compile it's fine, also I run it by sbt run it's fine, I displayed my message with success but he display an error; like this:

Hello my application!
16/11/27 15:17:11 ERROR Utils: uncaught error in thread SparkListenerBus,   stopping SparkContext
        java.lang.InterruptedException
     ERROR ContextCleaner: Error in cleaning thread
    java.lang.InterruptedException
     at org.apache.spark.ContextCleaner$$anon$1.run(ContextCleaner.scala:67)
    16/11/27 15:17:11 INFO SparkUI: Stopped Spark web UI at http://10.0.2.15:4040
    [success] Total time: 13 s, completed Nov 27, 2016 3:17:12 PM
    16/11/27 15:17:12 INFO DiskBlockManager: Shutdown hook called

我听不懂,好还是不好! 另外,当我尝试在运行后加载文件jar时,他也会显示一个错误:

I can't understand, it's fine or no! Also when i try to load my file jar after the run, he dispaly also an error:

我的命令行如下:

spark-submit "appfilms" --master local[4] target/scala-2.11/system-of-recommandation_2.11-1.0.jar

错误是:

Error: Cannot load main class from JAR file:/root/projectFilms/appfilms
Run with --help for usage help or --verbose for debug output
16/11/27 15:24:11 INFO Utils: Shutdown hook called

请您回答我!

推荐答案

该错误是由于未停止SparkContext导致的,在高于Spark 2.x的版本中需要此操作. 应该停止此操作,以防止通过SparkContext.stop()sc.stop()出现此错误.可以从自己的经验和以下来源获得解决此错误的灵感:火花上下文火花监听器总线错误

The error is due to the fact that the SparkContext is not stopped, this is required in versions higher than Spark 2.x. This should be stopped to prevent this error by SparkContext.stop(), or sc.stop(). Inspiration for solving this error is gained from own experiences and the following sources: Spark Context, Spark Listener Bus error

这篇关于无法从JAR文件加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆