{"record":{"id":"af7e8bc3e961c845","repo":"apache/iceberg","slug":"cannot-load-class-s-it-does-not-exist-in-the-cla-af7e8b","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/AwsProperties.java","lineNumber":567,"sourceCode":"    String sessionName =\n        this.clientAssumeRoleSessionName != null\n            ? this.clientAssumeRoleSessionName\n            : String.format(\"iceberg-aws-%s\", uuid);\n    return AssumeRoleRequest.builder()\n        .roleArn(this.clientAssumeRoleArn)\n        .roleSessionName(sessionName)\n        .durationSeconds(this.clientAssumeRoleTimeoutSec)\n        .externalId(this.clientAssumeRoleExternalId)\n        .tags(this.stsClientAssumeRoleTags)\n        .build();\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    AwsCredentialsProvider provider;\n    try {\n      try {\n        provider =\n            DynMethods.builder(\"create\")\n                .hiddenImpl(providerClass, Map.class)\n                .buildStaticChecked()","sourceCodeStart":549,"sourceCodeEnd":585,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/AwsProperties.java#L549-L585","documentation":"AwsProperties.credentialsProvider loads a user-configured AwsCredentialsProvider class by name via DynClasses; if the class is absent from the classpath it throws this IllegalArgumentException wrapping the ClassNotFoundException. This is the legacy AwsProperties path (as opposed to AwsClientProperties) for pluggable credential providers.","triggerScenarios":"Setting s3.windower... no — specifically setting the credentials-provider class property consumed by AwsProperties.credentialsProvider (e.g. client.credentials-provider for S3FileIO via AwsProperties) to a class name unresolvable by the classloader.","commonSituations":"Misspelled fully-qualified class name; custom provider JAR not shipped to driver/executors; class present in a different classloader (e.g. Spark cluster mode) than the one DynClasses uses; migration from one runtime bundle to another dropping a dependency.","solutions":["Correct the class name in the credentials-provider property.","Add the provider's JAR to the runtime classpath visible to the code creating AwsProperties.","Fall back to a default provider (e.g. software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider) if a custom one is not actually required."],"exampleFix":"// before\nprops.put(\"client.credentials-provider\", \"com.example.MyCredsProvider\");\n// after (corrected name and deployed jar)\nprops.put(\"client.credentials-provider\", \"com.example.creds.MyCredsProvider\");","handlingStrategy":"validation","validationCode":"try {\n  Class.forName(providerClassName, false, AwsProperties.class.getClassLoader());\n} catch (ClassNotFoundException e) {\n  throw new IllegalStateException(\"Provider class not resolvable: \" + providerClassName, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  props = new AwsProperties(config);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Cannot load class\")) {\n    LOG.error(\"Check class name and runtime classpath for: {}\", config.get(\"client.credentials-provider\"));\n  }\n  throw e;\n}","preventionTips":["Test provider class resolution in the exact runtime environment (driver + executors).","Keep provider JARs in the same classloader space as iceberg-aws.","Double-check fully-qualified names — package typos are the most common cause."],"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"}