{"record":{"id":"d3d0b370462e0176","repo":"apache/beam","slug":"problems-while-trying-to-instantiate-a-dynamic-web-id-token","errorCode":null,"errorMessage":"Problems while trying to instantiate a dynamic web id token provider class.","messagePattern":"Problems while trying to instantiate a dynamic web id token provider class\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/auth/WebIdTokenProvider.java","lineNumber":39,"sourceCode":"\n/**\n * Defines the behavior for a OIDC web identity token provider. Instances of this interface will be\n * used by an AWS credentials provider which will send the OIDC Token retrieved to dynamically\n * refresh federated authorized credentials.\n */\npublic interface WebIdTokenProvider {\n  /**\n   * Factory method for OIDC web identity token provider implementations.\n   *\n   * @param providerFQCN The fully qualified class name of an implementation of {@link\n   *     WebIdTokenProvider}.\n   * @return An instance of {@link WebIdTokenProvider}.\n   */\n  static WebIdTokenProvider create(String providerFQCN) {\n    try {\n      return InstanceBuilder.ofType(WebIdTokenProvider.class).fromClassName(providerFQCN).build();\n    } catch (ClassNotFoundException e) {\n      throw new RuntimeException(\n          \"Problems while trying to instantiate a dynamic web id token provider class.\", e);\n    }\n  }\n\n  /**\n   * Resolves the value for a OIDC web identity token.\n   *\n   * @param audience The audience for the token.\n   * @return The encoded value for the OIDC web identity token.\n   */\n  String resolveTokenValue(String audience);\n}\n","sourceCodeStart":21,"sourceCodeEnd":52,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/auth/WebIdTokenProvider.java#L21-L52","documentation":"WebIdTokenProvider.create throws a RuntimeException wrapping ClassNotFoundException when the fully-qualified class name given for a dynamic OIDC web identity token provider cannot be loaded/instantiated via InstanceBuilder. It allows AWS2 IO users to plug in custom token providers by class name.","triggerScenarios":"Calling WebIdTokenProvider.create(providerFQCN) with a class name that is misspelled, not on the classpath, or not a subclass of WebIdTokenProvider.","commonSituations":"Typo or wrong package in the provider FQCN; custom provider class not bundled in the worker's fat jar; shaded/relocated class names after building a pipeline jar; class present but lacks a no-arg constructor.","solutions":["Verify the FQCN spelling and that the class implements WebIdTokenProvider","Ensure the provider class is included in the pipeline jar/worker classpath","Check shading/relocation rules didn't rename the class in the fat jar","Give the provider a public no-arg constructor"],"exampleFix":"// before\nWebIdTokenProvider.create(\"com.example.MyProvider\"); // class not in jar\n// after: bundle the class and use the exact FQCN\nWebIdTokenProvider.create(\"com.example.providers.MyWebIdTokenProvider\");","handlingStrategy":"validation","validationCode":"try {\n  Class<?> c = Class.forName(providerFQCN);\n  if (!WebIdTokenProvider.class.isAssignableFrom(c)) {\n    throw new IllegalArgumentException(providerFQCN + \" is not a WebIdTokenProvider\");\n  }\n} catch (ClassNotFoundException e) {\n  throw new IllegalArgumentException(\"provider not on classpath\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  WebIdTokenProvider p = WebIdTokenProvider.create(fqcn);\n} catch (RuntimeException e) {\n  logger.error(\"check provider FQCN and worker jar contents\", e);\n  throw e;\n}","preventionTips":["Keep provider FQCNs in configuration constants","Verify class presence in the fat jar (unshaded name)","Provide a public no-arg constructor"],"tags":["java","reflection","classpath","aws-oidc"],"backgroundTag":"class-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}