java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.internal.ServiceUtils
See original GitHub issueI 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:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 ofjoda-time
andcommons-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.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.