{"record":{"id":"c32c11a4203198d0","repo":"apache/flink","slug":"can-not-register-process-function-transformation-t","errorCode":null,"errorMessage":"Can not register process function transformation translator.","messagePattern":"Can not register process function transformation translator\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"flink-datastream/src/main/java/org/apache/flink/datastream/impl/ExecutionEnvironmentImpl.java","lineNumber":98,"sourceCode":"    private final Configuration configuration;\n\n    private final ClassLoader userClassloader;\n\n    private final PipelineExecutorServiceLoader executorServiceLoader;\n\n    /**\n     * The environment of the context (local by default, cluster if invoked through command line).\n     */\n    private static ExecutionEnvironmentFactory contextEnvironmentFactory = null;\n\n    static {\n        try {\n            // All transformation translator must be put to a map in StreamGraphGenerator, but\n            // streaming-java is not depend on process-function module, using reflect to handle\n            // this.\n            DataStreamV2SinkTransformationTranslator.registerSinkTransformationTranslator();\n        } catch (Exception e) {\n            throw new RuntimeException(\n                    \"Can not register process function transformation translator.\", e);\n        }\n    }\n\n    /**\n     * Create and return an instance of {@link ExecutionEnvironment}.\n     *\n     * <p>IMPORTANT: The method is only expected to be called by {@link ExecutionEnvironment} via\n     * reflection, so we must ensure that the package path, class name and the signature of this\n     * method does not change.\n     */\n    public static ExecutionEnvironment newInstance() {\n        if (contextEnvironmentFactory != null) {\n            return contextEnvironmentFactory.createExecutionEnvironment(new Configuration());\n        } else {\n            final Configuration configuration = new Configuration();\n            configuration.set(DeploymentOptions.TARGET, \"local\");\n            configuration.set(DeploymentOptions.ATTACHED, true);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-datastream/src/main/java/org/apache/flink/datastream/impl/ExecutionEnvironmentImpl.java#L80-L116","documentation":"ExecutionEnvironmentImpl's static initializer wraps any failure of DataStreamV2SinkTransformationTranslator.registerSinkTransformationTranslator() in RuntimeException. That registration uses reflection because flink-datastream does not hard-depend on the process-function module, so linkage/classloading problems surface here. Because it fails in a static block, callers actually see ExceptionInInitializerError and the class becomes unusable (NoClassDefFoundError on later uses).","triggerScenarios":"Loading ExecutionEnvironmentImpl when the process-function translator classes (or their dependencies like flink-streaming-java internals) are missing or version-mismatched on the classpath; shaded/partial deployments that drop the reflected classes; mixed Flink versions in one job jar.","commonSituations":"Building a thin job jar against one Flink version and running on a cluster with another; excluding transitive flink-datastream/process-function dependencies; fat jars that relocate or omit org.apache.flink classes the reflection lookup needs.","solutions":["Align all flink-* artifacts in the job to the exact cluster Flink version (mvn dependency:tree | grep flink)","Ensure flink-datastream (and the process-function translator it reflects to) ships in the job jar or is provided by the dist","Rebuild the fat jar without relocation of org.apache.flink packages","Inspect the original cause in the stack trace — it names the exact missing class behind the wrapper RuntimeException"],"exampleFix":"# before: mixed versions\nflink-streaming-java:1.20.0, flink-datastream:2.0-SNAPSHOT -> ExceptionInInitializerError\n\n# after: pin all to the running distribution's version\n<flink.version>2.1.0</flink.version>  <!-- single property used by every flink-* dep -->","handlingStrategy":"try-catch","validationCode":"// fail fast at startup with a readable diagnosis instead of ExceptionInInitializerError deep in job submission\ntry {\n    Class.forName(\"org.apache.flink.datastream.impl.ExecutionEnvironmentImpl\");\n} catch (ExceptionInInitializerError | NoClassDefFoundError e) {\n    throw new IllegalStateException(\"flink-datastream runtime mismatch: check that all flink-* jars match the cluster version\", e.getCause());\n}","typeGuard":null,"tryCatchPattern":"catch (ExceptionInInitializerError e) { Throwable root = e.getCause(); /* root names the missing/mismatched class — report it, then fix classpath versions; retrying is pointless */ }","preventionTips":["Pin every flink-* dependency to the exact version of the running distribution via a single version property","Do not relocate or exclude org.apache.flink packages when shading job jars","Run mvn dependency:tree and check for duplicate flink-datastream/flink-streaming-java artifacts","Read the wrapped cause — it identifies the precise missing class behind the registration failure"],"tags":["datastream-v2","classpath","linkage","startup","version-mismatch"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}