{"record":{"id":"443ada38c2daa144","repo":"apache/iceberg","slug":"cannot-load-class-s-it-does-not-exist-in-the-cla","errorCode":null,"errorMessage":"Cannot load class %s, it does not exist in the classpath","messagePattern":"Cannot load class (.+?), it does not exist in the classpath","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aws/src/main/java/org/apache/iceberg/aws/AwsClientProperties.java","lineNumber":283,"sourceCode":"   * <p>Sample usage:\n   *\n   * <pre>\n   *     S3Client.builder().applyMutation(awsClientProperties::applyLegacyMd5Plugin)\n   * </pre>\n   */\n  public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> void applyLegacyMd5Plugin(\n      BuilderT builder) {\n    if (legacyMd5pluginEnabled) {\n      builder.addPlugin(LegacyMd5Plugin.create());\n    }\n  }\n\n  private AwsCredentialsProvider credentialsProvider(String credentialsProviderClass) {\n    Class<?> providerClass;\n    try {\n      providerClass = DynClasses.builder().impl(credentialsProviderClass).buildChecked();\n    } catch (ClassNotFoundException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot load class %s, it does not exist in the classpath\", credentialsProviderClass),\n          e);\n    }\n\n    Preconditions.checkArgument(\n        AwsCredentialsProvider.class.isAssignableFrom(providerClass),\n        String.format(\n            \"Cannot initialize %s, it does not implement %s.\",\n            credentialsProviderClass, AwsCredentialsProvider.class.getName()));\n\n    try {\n      return createCredentialsProvider(providerClass);\n    } catch (NoSuchMethodException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot create an instance of %s, it does not contain a static 'create' or 'create(Map<String, String>)' method\",\n              credentialsProviderClass),","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/AwsClientProperties.java#L265-L301","documentation":"AwsClientProperties.credentialsProvider attempts to load a user-supplied AwsCredentialsProvider implementation class by name via DynClasses. If the class is not on the classpath, ClassNotFoundException is wrapped and rethrown as this IllegalArgumentException. It exists so that custom credential providers can be plugged in by fully-qualified class name.","triggerScenarios":"Setting client.credentials-provider (or per-client credential provider properties consumed by applyClientCredentialConfigurations) to a class name that cannot be resolved by the current classloader.","commonSituations":"Typo in the fully-qualified class name; the JAR containing the custom provider is missing from the runtime classpath (e.g. present in Spark job but not in the Iceberg AWS runtime or distributed to executors); shading/proguard renamed the class.","solutions":["Verify the fully-qualified class name in client.credentials-provider is spelled correctly.","Add the JAR containing the provider class to the runtime classpath of the application and all executors.","If using the Iceberg AWS bundled runtime, confirm the provider isn't relying on an unshaded dependency; alternatively use a built-in provider (e.g. software.amazon.awssdk.auth.credentials.ContainerCredentialsProvider)."],"exampleFix":"// before\nprops.put(\"client.credentials-provider\", \"com.example.MyProvider\"); // jar not deployed\n// after\n// deploy my-provider.jar alongside iceberg-aws-bundle, then\nprops.put(\"client.credentials-provider\", \"com.example.MyProvider\");","handlingStrategy":"validation","validationCode":"try {\n  Class.forName(providerClassName, false, Thread.currentThread().getContextClassLoader());\n} catch (ClassNotFoundException e) {\n  throw new IllegalStateException(\"Credentials provider not on classpath: \" + providerClassName, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  io = new S3FileIO(config);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Cannot load class\")) {\n    LOG.error(\"Provider class missing from classpath: check executors too\");\n  }\n  throw e;\n}","preventionTips":["Verify class loading on driver AND executors with a smoke test at startup.","Deploy the provider JAR alongside iceberg-aws-bundle in every deployment environment.","Prefer built-in SDK providers when a custom one is not required."],"tags":["aws","classpath","reflection","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}