Hi All,
I tried to include necessary libraries in SPARK_CLASSPATH in spark-env.sh to 
include auxiliaries JARs and datanucleus*.jars from Hive, however, when I run 
HiveContext, it gives me the following error:
Caused by: java.lang.ClassNotFoundException: 
com.esotericsoftware.shaded.org.objenesis.strategy.InstantiatorStrategy
I have checked the JARs with (jar tf), looks like this is already included 
(shaded) in the assembly JAR (spark-assembly-1.2.0-hadoop2.4.1.jar) which is 
configured in the System classpath already. I couldn't figure out what is going 
on with the shading on the esotericsoftware JARs here. Any help is appreciated.
How to reproduce the problem?Run the following 3 statements in spark-shell ( 
This is how I launched my spark-shell. cd /opt/spark; ./bin/spark-shell 
--master yarn --deploy-mode client --queue research --driver-memory 1024M)
import org.apache.spark.SparkContextval hiveContext = new 
org.apache.spark.sql.hive.HiveContext(sc)hiveContext.hql("CREATE TABLE IF NOT 
EXISTS spark_hive_test_table (key INT, value STRING)")

A reference of my environment.Apache Hadoop 2.4.1Apache Hive 0.13.1Apache Spark 
branch-1.2 (installed under /opt/spark/, and config under /etc/spark/)Maven 
build command:







mvn -U -X -Phadoop-2.4 -Pyarn -Phive -Phive-0.13.1 -Dhadoop.version=2.4.1 
-Dyarn.version=2.4.1 -Dhive.version=0.13.1 -DskipTests install
Source Code commit label: eb4d457a870f7a281dc0267db72715cd00245e82
















My spark-env.sh have the following contents when I executed spark-shell:







HADOOP_HOME=/opt/hadoop/
HIVE_HOME=/opt/hive/
HADOOP_CONF_DIR=/etc/hadoop/
YARN_CONF_DIR=/etc/hadoop/
HIVE_CONF_DIR=/etc/hive/
HADOOP_SNAPPY_JAR=$(find $HADOOP_HOME/share/hadoop/common/lib/ -type f -name 
"snappy-java-*.jar")
HADOOP_LZO_JAR=$(find $HADOOP_HOME/share/hadoop/common/lib/ -type f -name 
"hadoop-lzo-*.jar")








SPARK_YARN_DIST_FILES=/user/spark/libs/spark-assembly-1.2.0-hadoop2.4.1.jar
export JAVA_LIBRARY_PATH=$JAVA_LIBRARY_PATH:$HADOOP_HOME/lib/native
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native
export SPARK_LIBRARY_PATH=$SPARK_LIBRARY_PATH:$HADOOP_HOME/lib/native
export 
SPARK_CLASSPATH=$SPARK_CLASSPATH:$HADOOP_SNAPPY_JAR:$HADOOP_LZO_JAR:$HIVE_CONF_DIR:/opt/hive/lib/datanucleus-api-jdo-3.2.6.jar:/opt/hive/lib/datanucleus-core-3.2.10.jar:/opt/hive/lib/datanucleus-rdbms-3.2.9.jar
Here's what I see from my stack trace.
warning: there were 1 deprecation warning(s); re-run with -deprecation for 
details
Hive history 
file=/home/hive/log/alti-test-01/hive_job_log_b5db9539-4736-44b3-a601-04fa77cb6730_1220828461.txt
java.lang.NoClassDefFoundError: 
com/esotericsoftware/shaded/org/objenesis/strategy/InstantiatorStrategy
        at org.apache.hadoop.hive.ql.exec.Utilities.<clinit>(Utilities.java:925)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.validate(SemanticAnalyzer.java:9718)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.validate(SemanticAnalyzer.java:9712)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:434)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:322)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:975)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1040)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:911)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:901)
        at org.apache.spark.sql.hive.HiveContext.runHive(HiveContext.scala:305)
        at 
org.apache.spark.sql.hive.HiveContext.runSqlHive(HiveContext.scala:276)
        at 
org.apache.spark.sql.hive.execution.NativeCommand.sideEffectResult$lzycompute(NativeCommand.scala:35)
        at 
org.apache.spark.sql.hive.execution.NativeCommand.sideEffectResult(NativeCommand.scala:35)
        at 
org.apache.spark.sql.execution.Command$class.execute(commands.scala:46)
        at 
org.apache.spark.sql.hive.execution.NativeCommand.execute(NativeCommand.scala:30)
        at 
org.apache.spark.sql.SQLContext$QueryExecution.toRdd$lzycompute(SQLContext.scala:425)
        at 
org.apache.spark.sql.SQLContext$QueryExecution.toRdd(SQLContext.scala:425)
        at 
org.apache.spark.sql.SchemaRDDLike$class.$init$(SchemaRDDLike.scala:58)
        at org.apache.spark.sql.SchemaRDD.<init>(SchemaRDD.scala:108)
        at org.apache.spark.sql.hive.HiveContext.hiveql(HiveContext.scala:102)
        at org.apache.spark.sql.hive.HiveContext.hql(HiveContext.scala:106)
        at $iwC$$iwC$$iwC$$iwC.<init>(<console>:16)
        at $iwC$$iwC$$iwC.<init>(<console>:21)
        at $iwC$$iwC.<init>(<console>:23)
        at $iwC.<init>(<console>:25)
        at <init>(<console>:27)
        at .<init>(<console>:31)
        at .<clinit>(<console>)
        at .<init>(<console>:7)
        at .<clinit>(<console>)
        at $print(<console>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:852)
        at 
org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1125)
        at 
org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:674)
        at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:705)
        at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:669)
        at 
org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:828)
        at 
org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:873)
        at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:785)
        at org.apache.spark.repl.SparkILoop.processLine$1(SparkILoop.scala:628)
        at org.apache.spark.repl.SparkILoop.innerLoop$1(SparkILoop.scala:636)
        at org.apache.spark.repl.SparkILoop.loop(SparkILoop.scala:641)
        at 
org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply$mcZ$sp(SparkILoop.scala:968)
        at 
org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:916)
        at 
org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:916)
        at 
scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
        at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:916)
        at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1011)
        at org.apache.spark.repl.Main$.main(Main.scala:31)
        at org.apache.spark.repl.Main.main(Main.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:353)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: 
com.esotericsoftware.shaded.org.objenesis.strategy.InstantiatorStrategy
        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)
        ... 61 more

                                          

Reply via email to