From 6a26993b28ac4b96e966464d3e24d66245961046 Mon Sep 17 00:00:00 2001 From: Dirk Buchhorn Date: Mon, 20 Aug 2018 14:28:40 +0200 Subject: [PATCH 1/2] Issue #520 ClassLoader problem use ClassLoader of class SenderFactory to instantiate the ServiceLoader to prevent a ServiceConfigurationError (java.util.ServiceConfigurationError: io.jaegertracing.spi.SenderFactory: Provider io.jaegertracing.thrift.internal.senders.ThriftSenderFactory not a subtype) Signed-off-by: Dirk Buchhorn --- .../java/io/jaegertracing/internal/senders/SenderResolver.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java b/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java index b81c70c47..734070f5b 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java +++ b/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java @@ -51,7 +51,8 @@ public static Sender resolve() { */ public static Sender resolve(Configuration.SenderConfiguration senderConfiguration) { Sender sender = null; - ServiceLoader senderFactoryServiceLoader = ServiceLoader.load(SenderFactory.class); + ServiceLoader senderFactoryServiceLoader = ServiceLoader.load(SenderFactory.class, + SenderFactory.class.getClassLoader()); Iterator senderFactoryIterator = senderFactoryServiceLoader.iterator(); boolean hasMultipleFactories = false; From a14edebe18c22b5926eb716c171b8239bb63c58f Mon Sep 17 00:00:00 2001 From: Dirk Buchhorn Date: Tue, 21 Aug 2018 08:40:19 +0200 Subject: [PATCH 2/2] correct indentation level Signed-off-by: Dirk Buchhorn --- .../java/io/jaegertracing/internal/senders/SenderResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java b/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java index 734070f5b..0e5d5b293 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java +++ b/jaeger-core/src/main/java/io/jaegertracing/internal/senders/SenderResolver.java @@ -52,7 +52,7 @@ public static Sender resolve() { public static Sender resolve(Configuration.SenderConfiguration senderConfiguration) { Sender sender = null; ServiceLoader senderFactoryServiceLoader = ServiceLoader.load(SenderFactory.class, - SenderFactory.class.getClassLoader()); + SenderFactory.class.getClassLoader()); Iterator senderFactoryIterator = senderFactoryServiceLoader.iterator(); boolean hasMultipleFactories = false;