spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: class not found exception Logging while running JavaKMeansExample
Date Tue, 16 Aug 2016 11:37:08 GMT
The class is:
core/src/main/scala/org/apache/spark/internal/Logging.scala

So it is in spark-core.

On Tue, Aug 16, 2016 at 2:33 AM, subash basnet <yasubash@gmail.com> wrote:

> Hello Yuzhihong,
>
> I didn't get how to implement what you said in the JavaKMeansExample.java.
> As I get the logging exception as while creating the spark session:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/spark/internal/Logging
> at com.dfki.spark.kmeans.KMeansSpark.JavaKMeansExample.
> main(JavaKMeansExample.java*:43*)
> Caused by: java.lang.ClassNotFoundException: org.apache.spark.internal.
> Logging
>
> The exception occurs at the *builder()*:
>
> 42    SparkSession spark = SparkSession
> *43     .builder()*
> 44      .appName("JavaKMeansExample")
> 45     .getOrCreate();
>
> I have added all the necessary log4j and sl4j dependencies in pom. I am
> still not getting what dependencies I am missing.
>
> Best Regards,
> Subash Basnet
>
> On Mon, Aug 15, 2016 at 6:50 PM, Ted Yu <yuzhihong@gmail.com> wrote:
>
>> Logging has become private in 2.0 release:
>>
>> private[spark] trait Logging {
>>
>> On Mon, Aug 15, 2016 at 9:48 AM, subash basnet <yasubash@gmail.com>
>> wrote:
>>
>>> Hello all,
>>>
>>> I am trying to run JavaKMeansExample of the spark example project. I am
>>> getting the classnotfound exception error:
>>> *Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/spark/internal/Logging*
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
>>> at jcom.dfki.spark.kmeans.KMeansSpark.JavaKMeansExample.main(Ja
>>> vaKMeansExample.java:43)
>>> *Caused by: java.lang.ClassNotFoundException:
>>> org.apache.spark.internal.Logging*
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>
>>> I have added all the logging related dependencies as below:
>>> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId>
>>> <version>${slf4j.version}</version> </dependency> <dependency>
>>> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>
>>> <version>${slf4j.version}</version> <scope>${hadoop.deps.scope}</scope>
>>> </dependency> <dependency> <groupId>org.slf4j</groupId>
>>> <artifactId>jul-to-slf4j</artifactId> <version>${slf4j.version}</version>
>>> </dependency> <dependency> <groupId>org.slf4j</groupId>
>>> <artifactId>jcl-over-slf4j</artifactId> <version>${slf4j.version}</version>
>>> <!-- <scope>runtime</scope> --> <!-- more correct, but scalac
2.10.3
>>> doesn't like it --> </dependency> <dependency> <groupId>log4j</groupId>
>>> <artifactId>log4j</artifactId> <version>${log4j.version}</version>
>>> </dependency> <dependency> <groupId>commons-logging</groupId>
>>> <artifactId>commons-logging</artifactId> <version>1.2</version>
>>> </dependency> What depedencies could I be missing, any idea? Regards,
>>> Subash Basnet
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe e-mail: user-unsubscribe@spark.apache.org
>>>
>>
>>
>

Mime
View raw message