From 14069bcd1735f21a6d9724492a905f5cd64775a6 Mon Sep 17 00:00:00 2001 From: Kabir Khan Date: Tue, 12 May 2026 19:14:25 +0100 Subject: [PATCH] fix: Set TCCL before initialising A2AHttpClientFactory It has a ServiceLoader using the TCCL to find clients --- .../sdk/server/tasks/BasePushNotificationSender.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server-common/src/main/java/org/a2aproject/sdk/server/tasks/BasePushNotificationSender.java b/server-common/src/main/java/org/a2aproject/sdk/server/tasks/BasePushNotificationSender.java index 53f1a38d3..b781c5705 100644 --- a/server-common/src/main/java/org/a2aproject/sdk/server/tasks/BasePushNotificationSender.java +++ b/server-common/src/main/java/org/a2aproject/sdk/server/tasks/BasePushNotificationSender.java @@ -56,7 +56,15 @@ protected BasePushNotificationSender() { @Inject public BasePushNotificationSender(PushNotificationConfigStore configStore) { - this.httpClient = A2AHttpClientFactory.create(); + // Make sure the TCCL is one of the platform ones before the ServiceLoader + // in A2AHttpClientFactory's static initializer + ClassLoader originalTccl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(BasePushNotificationSender.class.getClassLoader()); + this.httpClient = A2AHttpClientFactory.create(); + } finally { + Thread.currentThread().setContextClassLoader(originalTccl); + } this.configStore = configStore; }