{"record":{"id":"d1a0cfe1a283d79c","repo":"apache/beam","slug":"no-udfprovider-implementation-found-in-jarpath-create-a","errorCode":null,"errorMessage":"No UdfProvider implementation found in ${jarPath}. Create a class implementing UdfProvider and annotate it with @AutoService(UdfProvider.class).","messagePattern":"No UdfProvider implementation found in (.+?)\\. Create a class implementing UdfProvider and annotate it with @AutoService\\(UdfProvider\\.class\\)\\.","errorType":"exception","errorClass":"ProviderNotFoundException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/JavaUdfLoader.java","lineNumber":246,"sourceCode":"                }\n                scalarFunctions.put(functionPath, implementation);\n              });\n      provider\n          .userDefinedAggregateFunctions()\n          .forEach(\n              (functionName, implementation) -> {\n                List<String> functionPath = ImmutableList.copyOf(functionName.split(\"\\\\.\"));\n                if (aggregateFunctions.containsKey(functionPath)) {\n                  throw new IllegalArgumentException(\n                      String.format(\n                          \"Found multiple definitions of aggregate function %s in %s.\",\n                          functionName, jarPath));\n                }\n                aggregateFunctions.put(functionPath, implementation);\n              });\n    }\n    if (providersCount == 0) {\n      throw new ProviderNotFoundException(\n          String.format(\n              \"No %s implementation found in %s. Create a class implementing %s and annotate it with @AutoService(%s.class).\",\n              UdfProvider.class.getSimpleName(),\n              jarPath,\n              UdfProvider.class.getSimpleName(),\n              UdfProvider.class.getSimpleName()));\n    }\n    LOG.info(\n        \"Loaded {} implementations of {} from {} with {} scalar function(s).\",\n        providersCount,\n        UdfProvider.class.getSimpleName(),\n        jarPath,\n        scalarFunctions.size());\n    FunctionDefinitions userFunctionDefinitions =\n        FunctionDefinitions.newBuilder()\n            .setScalarFunctions(ImmutableMap.copyOf(scalarFunctions))\n            .setAggregateFunctions(ImmutableMap.copyOf(aggregateFunctions))\n            .build();","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/JavaUdfLoader.java#L228-L264","documentation":"JavaUdfLoader.loadJar scans a user-supplied JAR for a class implementing the UdfProvider interface (discovered via ServiceLoader / @AutoService metadata) to register its UDFs and aggregate functions. When the JAR contains no such provider (providersCount == 0), the loader throws ProviderNotFoundException because there is nothing to load. It is a user-JAR contract violation, not an internal failure.","triggerScenarios":"Calling JavaUdfLoader.loadJar(jarPath, functionNames) (via functionDefinitions) with a JAR that contains zero classes implementing UdfProvider registered under META-INF/services/org.apache.beam...UdfProvider — e.g. built without @AutoService(UdfProvider.class) annotation processing or an explicit services resource file.","commonSituations":"Forgetting to add the auto-service dependency/annotation processor so META-INF/services is never generated; annotating the wrong class or an inner class; building a fat JAR that strips service files (e.g. shade merging without ServicesResourceTransformer); pointing at a data/dependency JAR instead of the UDF JAR.","solutions":["Create a public class implementing org.apache.beam.sdk.extensions.sql.udf.UdfProvider and annotate it with com.google.auto.service.AutoService(UdfProvider.class).","Verify META-INF/services/org.apache.beam.sdk.extensions.sql.udf.UdfProvider exists inside the JAR listing the implementation class (unzip -l jarPath).","Ensure the auto-service annotation processor runs: keep the com.google.auto.service:auto-service dependency in the 'compile' scope (processor) of the UDF module.","If using maven-shade-plugin, add the ServicesResourceTransformer so service files from dependencies are merged.","Double-check the jarPath passed to loadJar points at the artifact containing the provider class."],"exampleFix":"// before\npublic class MyUdfs { /* no UdfProvider */ }\n// after\n@AutoService(UdfProvider.class)\npublic class MyUdfs implements UdfProvider {\n  @Override\n  public Collection<Udf> getUserDefinedFunctions() {\n    return Collections.singletonList(new MyFn());\n  }\n}","handlingStrategy":"validation","validationCode":"boolean hasProvider(java.util.jar.JarFile jar) throws java.io.IOException {\n  return jar.getEntry(\"META-INF/services/org.apache.beam.sdk.extensions.sql.udf.UdfProvider\") != null;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always annotate the provider class with @AutoService(UdfProvider.class) and keep auto-service as an annotation processor dependency.","Add an integration test that loads the built JAR via JavaUdfLoader before release.","Verify service files survive shading by checking the final artifact's META-INF/services directory."],"tags":["java","udf","classpath","service-loader","beam-sql"],"backgroundTag":"missing-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}