找不到Web UI的资源路径:org / apache / spark / ui / static创建Spark应用程序时 [英] Could not find resource path for Web UI: org/apache/spark/ui/static While creating a Spark application

查看:1952
本文介绍了找不到Web UI的资源路径:org / apache / spark / ui / static创建Spark应用程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spark-cassandra-connector创建一个java API。当它运行在eclipse上时,它工作正常。然后我创建了一个可运行的jar文件,并通过命令行执行它,它给我以下错误。

  15/02/17 14:56:41 INFO spark.HttpServer:启动HTTP服务器
15/02/17 14:56:42 INFO server.Server:jetty-8.yz-SNAPSHOT
15/02/17 14: 56:42 INFO server.AbstractConnector:Started SocketConnector@0.0.0.0:58625
线程main中的异常java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
在org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
导致:java.lang.Exception:找不到Web UI的资源路径:org / apache / spark / ui / static
在org.apach e.spark.ui.JettyUtils $ .createStaticHandler(JettyUtils.scala:
133)
在org.apache.spark.ui.SparkUI.initialize(SparkUI.scala:70)
在org .apache.spark.ui.SparkUI。< init>(SparkUI.scala:60)
在org.apache.spark.ui.SparkUI。< init>(SparkUI.scala:42)
在org.apache.spark.SparkContext。< init>(SparkContext.scala:222)
在org.apache.spark.SparkContext。< init>(SparkContext.scala:97)
at com .netspective.watchtower.bigdata.utils.Config.getSparkContext(Confi
g.java:32)
在com.netspective.watchtower.bigdata.main.Main.main(Main.java:17)
... 5更多

日志文件与eclipse日志之间的唯一区别是jetty-server的版本。在eclipse中,它将Jetty服务器版本识别为8.1.14 v232。但是,它的标识为8.y.z SNAPSHOT。
这是因为jetty服务器还是其他原因?我完全被困在这里。



我的sparkContext配置如下

  conf.setAppName(Java API demo); 
conf.setMaster(local [*]);


解决方案

Spark使用getResource读取打包的文件用它。在这里,它尝试读取Web UI的一些静态文件,如果这些文件被打包到jar中,这个文件显然不起作用。相反,它们必须被提取到jar中,Eclipse提供了第一个选项:


I am creating a java API using spark-cassandra-connector.When it is running on eclipse it is working fine. Then i created a runnable jar file and executed it through the command line , its giving me following error.

15/02/17 14:56:41 INFO spark.HttpServer: Starting HTTP Server
    15/02/17 14:56:42 INFO server.Server: jetty-8.y.z-SNAPSHOT
    15/02/17 14:56:42 INFO server.AbstractConnector: Started SocketConnector@0.0.0.0:58625
    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
    der.java:58)
    Caused by: java.lang.Exception: Could not find resource path for Web UI: org/apache/spark/ui/static    
    at org.apache.spark.ui.JettyUtils$.createStaticHandler(JettyUtils.scala:
    133)
            at org.apache.spark.ui.SparkUI.initialize(SparkUI.scala:70)
            at org.apache.spark.ui.SparkUI.<init>(SparkUI.scala:60)
            at org.apache.spark.ui.SparkUI.<init>(SparkUI.scala:42)
            at org.apache.spark.SparkContext.<init>(SparkContext.scala:222)
            at org.apache.spark.SparkContext.<init>(SparkContext.scala:97)
            at com.netspective.watchtower.bigdata.utils.Config.getSparkContext(Confi
    g.java:32)
            at com.netspective.watchtower.bigdata.main.Main.main(Main.java:17)
            ... 5 more

The only difference between the log files comparing to eclipse log is regarding the version of jetty-server. In eclipse it identifiesthe jetty server version as the 8.1.14 v232 .But above its identifying as 8.y.z SNAPSHOT. Is this because of jetty server or any other reason? I am totally stuck here.

My sparkContext configuration is follows

  conf.setAppName("Java API demo");
        conf.setMaster("local[*]");

解决方案

Spark uses "getResource" to read files that are packaged with it. Here it tries to read some static files for the Web UI, which apparently does not work if the files are packaged into the jar. Instead, they must be extracted into the jar, which Eclipse offers as the first option:

这篇关于找不到Web UI的资源路径:org / apache / spark / ui / static创建Spark应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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