diff --git a/libs/core/src/main/java/org/opensearch/core/xcontent/MediaTypeParserRegistry.java b/libs/core/src/main/java/org/opensearch/core/xcontent/MediaTypeParserRegistry.java index 91de1e1f6491d..812624e82ad6b 100644 --- a/libs/core/src/main/java/org/opensearch/core/xcontent/MediaTypeParserRegistry.java +++ b/libs/core/src/main/java/org/opensearch/core/xcontent/MediaTypeParserRegistry.java @@ -62,7 +62,7 @@ public final class MediaTypeParserRegistry { static { List mediaTypes = new ArrayList<>(); Map amt = new HashMap<>(); - for (MediaTypeProvider provider : ServiceLoader.load(MediaTypeProvider.class)) { + for (MediaTypeProvider provider : ServiceLoader.load(MediaTypeProvider.class, MediaTypeProvider.class.getClassLoader())) { mediaTypes.addAll(provider.getMediaTypes()); amt = Stream.of(amt, provider.getAdditionalMediaTypes()) .flatMap(map -> map.entrySet().stream())