如何在

时间:2016-06-02 14:25:34

标签: scala apache-spark sbt sbt-assembly

我已经从Intellij创建了jar的spark + scala代码,并尝试在dev集群中运行jar,但我最终得到以下错误:

Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
        at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:286)
        at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:239)
        at java.util.jar.JarVerifier.processEntry(JarVerifier.java:317)
        at java.util.jar.JarVerifier.update(JarVerifier.java:228)
        at java.util.jar.JarFile.initializeVerifier(JarFile.java:348)
        at java.util.jar.JarFile.getInputStream(JarFile.java:415)
        at sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
        at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:674)
        at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
        at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:638)
        at sun.misc.URLClassPath$3.run(URLClassPath.java:366)
        at sun.misc.URLClassPath$3.run(URLClassPath.java:356)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
        at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
        at sun.misc.URLClassPath.getResource(URLClassPath.java:198)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at org.apache.spark.util.Utils$.classForName(Utils.scala:174)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:689)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
    enter code here

请问您如何排除META-INF详细信息?

感谢。

1 个答案:

答案 0 :(得分:0)

您需要添加maven-shade插件并使用excludes,如下所示:

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
           ..
          <filters>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.RSA</exclude>
              </excludes>
            </filter>
          </filters>

这将删除已签名的文件并解决您的问题。