Skip to content

Conversation

@zjffdu
Copy link
Contributor

@zjffdu zjffdu commented Oct 15, 2015

…ut building with -Phive-thriftserver and SPARK_PREPEND_CLASSES is set

This is the exception after this patch. Please help review.

java.lang.NoClassDefFoundError: org/apache/hadoop/hive/cli/CliDriver
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
    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:173)
    at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:647)
    at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
    at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.cli.CliDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 21 more
Failed to load hive class.
You need to build Spark with -Phive and -Phive-thriftserver.

…ut building with -Phive-thriftserver and SPARK_PREPEND_CLASSES is set
@SparkQA
Copy link

SparkQA commented Oct 15, 2015

Test build #43774 has finished for PR 9134 at commit 2bdf979.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 15, 2015

Test build #43783 has finished for PR 9134 at commit 5b6e651.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zjffdu
Copy link
Contributor Author

zjffdu commented Oct 15, 2015

Check the test report. Seems the failed unit tests are unrelated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this OK. (PS the exception isn't "unreadable" -- just "uninformative"). NoClassDefFoundError is lower-level problem; classes were compiled in the presence of some other classes that aren't available at runtime. It's "worse" than ClassNotFoundException. It probably makes sense, but is this really a problem of building without Hive support? I would kind of think it's the opposite: you built with Hive and then it's not available at runtime?

@andrewor14
Copy link
Contributor

Are we certain that we only get NoClassDefFoundError but not also ClassNotFoundException? I wonder if we should just check for either of those in the match. Also cc @yhuai

@zjffdu zjffdu changed the title [SPARK-11125] [SQL] Unreadable exception when running spark-sql witho… [SPARK-11125] [SQL] Uninformative exception when running spark-sql witho… Oct 19, 2015
@srowen
Copy link
Member

srowen commented Oct 22, 2015

@zjffdu given your similar PR on this topic, can you address the question of how this occurs? The "Error" is a different lower-level thing.

@zjffdu
Copy link
Contributor Author

zjffdu commented Oct 23, 2015

@andrewor14 @srowen Here's how to reproduce the issue.

  1. export SPARK_PREPEND_CLASSES=true
  2. Build spark with command: build/sbt assembly -Pyarn -Phadoop-2.6 -Phive -Phive-thriftserver
  3. Build spark again with command: build/sbt assembly -Pyarn -Phadoop-2.6
  4. Start spark-sql: bin/spark-sql

The root cause is that we still have SparkSQLCLIDriver in classpath (under sql/hive-thriftserver/target). But we don't have hive related classes in classpath.

@srowen
Copy link
Member

srowen commented Oct 23, 2015

Hm, it still sounds like it's more of an artifact of mixing build artifacts. Something is being loaded that was compiled with Hive support, but then finds it's actually missing. Even though that's an error you'd only encounter as a developer (?) I suppose that's still a good motive. OK by me.

@zjffdu
Copy link
Contributor Author

zjffdu commented Oct 23, 2015

Yes, that would be encountered as developer

@yhuai
Copy link
Contributor

yhuai commented Oct 23, 2015

ok to test

@yhuai
Copy link
Contributor

yhuai commented Oct 23, 2015

test this please

@SparkQA
Copy link

SparkQA commented Oct 23, 2015

Test build #44232 has finished for PR 9134 at commit 5b6e651.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zjffdu
Copy link
Contributor Author

zjffdu commented Oct 24, 2015

Seems the failed test is not related

@yhuai
Copy link
Contributor

yhuai commented Oct 24, 2015

test this please

@SparkQA
Copy link

SparkQA commented Oct 24, 2015

Test build #44286 has finished for PR 9134 at commit 5b6e651.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Oct 24, 2015

Thanks! Merging to master.

@asfgit asfgit closed this in ffed004 Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants