Skip to content

Commit f0459f6

Browse files
Fix S3ClientSettings Class Loading (#66886)
This is motivated by the inability to run `org.elasticsearch.repositories.encrypted.EncryptedS3BlobStoreRepositoryIntegTests` in isolation without this workaround. The way integration tests load classes otherwise leads to a load order which doesn't load the plugin class first, thus fails to apply the jackson workaround before further S3 classes are loaded but depend on our Jackson workaround.
1 parent 4a5396a commit f0459f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@
4141
*/
4242
final class S3ClientSettings {
4343

44+
static {
45+
// Make sure repository plugin class is loaded before this class is used to trigger static initializer for that class which applies
46+
// necessary Jackson workaround
47+
try {
48+
Class.forName("org.elasticsearch.repositories.s3.S3RepositoryPlugin");
49+
} catch (ClassNotFoundException e) {
50+
throw new AssertionError(e);
51+
}
52+
}
53+
4454
// prefix for s3 client settings
4555
private static final String PREFIX = "s3.client.";
4656

0 commit comments

Comments
 (0)