Alok
Alok

Reputation: 1506

NoClassDefFoundError in Spark Submit

I am working on a spark application . I am using a third party jar. I added it in my sbt file. The compilation was successful

> libraryDependencies += "org.springframework.security" %
> "spring-security-web" % "3.0.7.RELEASE

But when i submit spark job

spark-submit --master yarn-client --class MyClass target/scala-2.10/my-app.jar

It fails with following error:

Exception in thread "main" org.apache.spark.SparkException: Job aborted due to 
stage failure: Task 0 in stage 48.0 failed 1 times, most recent failure: Lost task 0.0 in stage 48.0 (TID 3216, localhost): 
`java.lang.NoClassDefFoundError:` org/springframework/security/web/util/IpAddressMatcher

I also tried explicitly passing jar in spark-submit jar

spark-submit --master yarn-client --jars third-party-jars/spring-security-web-3.0.7.RELEASE.jar --class MyClass target/scala-2.10/my-app.jar

But then it fails with following error:

java.lang.NoClassDefFoundError: org/springframework/util/StringUtils
    at org.springframework.security.web.util.IpAddressMatcher.<init>(IpAddressMatcher.java:33)

Its similar error but on another class.

Any suggestion on how to resolve this?

Thanks

Upvotes: 0

Views: 1082

Answers (1)

Thoram Mastero
Thoram Mastero

Reputation: 159

Also you can use IntelijIDE. You will not need to adjust it always. You can download here for Ubuntu. https://apps.ubuntu.com/cat/applications/intellij-idea-ce/

Upvotes: 1

Related Questions