question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.internal.ServiceUtils

See original GitHub issue

I am building a spark project using scala in Intellij. I have added the following dependencies:

spark-redshift_2.10-0.5.1-SNAPSHOT RedshiftJDBC41-1.1.7.1007 httpcore-4.4.3 httpclient-4.5.1 aws-java-sdk-s3-1.10.23-SNAPSHOT aws-java-sdk-core-1.10.23-SNAPSHOT

I am recieving the following error: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.internal.ServiceUtils

where running val df = sqlContext.read.foramat(“com.databricks.spark.redshift”) .option(“url”, “jdbc:redshift://AWS_SERVER:5439/warehouse?user=USER&password=PWD”) .option(“dbtable”, “fact_time”) .option(“tempdir”, “s3n://bucket/path”) .load()

df.show()

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
JoshRosencommented, Oct 5, 2015

Based on the stacktrace, my hunch is that this is being caused by an exception in the com.amazonaws.services.s3.internal.ServiceUtils class’s static initialization code. According to http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core/1.10.22, aws-java-sdk-core has additional dependencies which you have not included in your project. Can you try including an appropriate version of joda-time and commons-logging to see if that fixes things?

My hunch is that ServiceUtils is trying to call a DateUtils method via its static initializer, which is failing due to missing joda-time classes.

0reactions
JoshRosencommented, Oct 6, 2015

Glad to hear that you were able to get things working!

In the future, I’d like to relax the requirement that the S3 bucket and Redshift cluster belong to the same region; please follow #87 to track progress on that issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not initialize class com.amazonaws.services.s3.internal ...
Jenkins build fails when multiple versions of the aws-sdk-core and aws-sdk-s3 library exists Describe the bug I am using the latest version ...
Read more >
java.lang.NoClassDefFoundError: Could not initialize class ...
The ClientConfiguration of aws-java-sdk-osgi-1.11.26.jar is dependent of ... So it is not able to initialize ClientConfiguration.
Read more >
[AWS SDK] java.lang.NoClassDefFoundError: Could not ...
This exception " java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration. does not necessarily mean that the problem is ...
Read more >
Could not initialize class com.amazonaws.ClientConfiguration
java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration at com.amazonaws.services.s3.AmazonS3Client.
Read more >
Could not initialize class com.amazonaws.services.s3.internal ...
Bamboo unable to handle S3 error response due to: NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.internal.S3ErrorResponseHandler.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found