英文:
Illegal access to create StreamTableEnvironment with JDK 9 in debian
问题
我在我的 Flink 1.11 应用程序中创建了一个 StreamTableEnvironment,在 Windows 上可以工作,但是当我尝试在具有 JDK9(与 Windows 中相同版本)的 Debian 中部署我的 jar 文件时,会抛出以下错误:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.flink.table.planner.calcite.FlinkRelFactories$.<init>(FlinkRelFactories.scala:51)
at org.apache.flink.table.planner.calcite.FlinkRelFactories$.<clinit>(FlinkRelFactories.scala)
at org.apache.flink.table.planner.calcite.FlinkRelFactories.FLINK_REL_BUILDER(FlinkRelFactories.scala)
at org.apache.flink.table.planner.delegation.PlannerContext.lambda$getSqlToRelConverterConfig$2(PlannerContext.java:279)
...
这是我如何使用 StreamTableEnvironment 的方式:
StreamTableEnvironment tableEnv = StreamTableEnvironment.create(StreamingJob.env);
tableEnv.getConfig().getConfiguration().setString("python.files", PropertyFileReader.getPythonFiles());
tableEnv.getConfig().getConfiguration().setString("python.client.executable", PropertyFileReader.getPythonClientExecutable());
tableEnv.getConfig().getConfiguration().setString("python.executable", PropertyFileReader.getPythonExecutable());
tableEnv.getConfig().getConfiguration().setString("taskmanager.memory.task.off-heap.size", "79mb");
// 注册 Python UDF
tableEnv.executeSql("CREATE TEMPORARY SYSTEM FUNCTION Inference AS '" + PropertyFileReader.getPythonInferenceFunction() + "' LANGUAGE PYTHON");
错误出现在这一行:StreamTableEnvironment tableEnv = StreamTableEnvironment.create(StreamingJob.env);
我正在使用 Flink 1.11 与以下依赖项:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-python_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
英文:
I'm creating a StreamTableEnvironment in my Flink 1.11 application, and this works in Windows, but then, when I'm trying to deploy mi jar in Debian with JDK9(same version in Windows) it throws this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.flink.table.planner.calcite.FlinkRelFactories$.<init>(FlinkRelFactories.scala:51)
at org.apache.flink.table.planner.calcite.FlinkRelFactories$.<clinit>(FlinkRelFactories.scala)
at org.apache.flink.table.planner.calcite.FlinkRelFactories.FLINK_REL_BUILDER(FlinkRelFactories.scala)
at org.apache.flink.table.planner.delegation.PlannerContext.lambda$getSqlToRelConverterConfig$2(PlannerContext.java:279)
at java.util.Optional.orElseGet(java.base@9-internal/Optional.java:344)
at org.apache.flink.table.planner.delegation.PlannerContext.getSqlToRelConverterConfig(PlannerContext.java:273)
at org.apache.flink.table.planner.delegation.PlannerContext.createFrameworkConfig(PlannerContext.java:137)
at org.apache.flink.table.planner.delegation.PlannerContext.<init>(PlannerContext.java:113)
at org.apache.flink.table.planner.delegation.PlannerBase.<init>(PlannerBase.scala:112)
at org.apache.flink.table.planner.delegation.StreamPlanner.<init>(StreamPlanner.scala:48)
at org.apache.flink.table.planner.delegation.BlinkPlannerFactory.create(BlinkPlannerFactory.java:50)
at org.apache.flink.table.api.bridge.java.internal.StreamTableEnvironmentImpl.create(StreamTableEnvironmentImpl.java:130)
at org.apache.flink.table.api.bridge.java.StreamTableEnvironment.create(StreamTableEnvironment.java:111)
at org.apache.flink.table.api.bridge.java.StreamTableEnvironment.create(StreamTableEnvironment.java:82)
at com.teavaro.cep.modules.ml.CEPMLInit.runUseCase(CEPMLInit.java:57)
at com.teavaro.cep.modules.ml.CEPMLInit.start(CEPMLInit.java:43)
at com.teavaro.cep.modules.ml.CEPMLInit.prepareUseCase(CEPMLInit.java:35)
at com.teavaro.cep.pipelines.CEPInit.start(CEPInit.java:47)
at com.teavaro.cep.StreamingJob.runCEP(StreamingJob.java:121)
at com.teavaro.cep.StreamingJob.prepareJob(StreamingJob.java:106)
at com.teavaro.cep.StreamingJob.main(StreamingJob.java:64)
Caused by: java.lang.RuntimeException: while binding method public default org.apache.calcite.tools.RelBuilder$ConfigBuilder org.apache.calcite.tools.RelBuilder$Config.toBuilder()
at org.apache.calcite.util.ImmutableBeans.create(ImmutableBeans.java:215)
at org.apache.calcite.tools.RelBuilder$Config.<clinit>(RelBuilder.java:3074)
... 21 more
Caused by: java.lang.IllegalAccessException: access to public member failed: org.apache.calcite.tools.RelBuilder$Config.toBuilder()ConfigBuilder/invokeSpecial, from org.apache.calcite.tools.RelBuilder$Config/2 (unnamed module @2cc03cd1)
at java.lang.invoke.MemberName.makeAccessException(java.base@9-internal/MemberName.java:908)
at java.lang.invoke.MethodHandles$Lookup.checkAccess(java.base@9-internal/MethodHandles.java:1839)
at java.lang.invoke.MethodHandles$Lookup.checkMethod(java.base@9-internal/MethodHandles.java:1779)
at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(java.base@9-internal/MethodHandles.java:1928)
at java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(java.base@9-internal/MethodHandles.java:1922)
at java.lang.invoke.MethodHandles$Lookup.unreflectSpecial(java.base@9-internal/MethodHandles.java:1480)
at org.apache.calcite.util.ImmutableBeans.create(ImmutableBeans.java:213)
and this is how I'm using the StreamTableEnvironment:
StreamTableEnvironment tableEnv = StreamTableEnvironment.create(StreamingJob.env);
tableEnv.getConfig().getConfiguration().setString("python.files", PropertyFileReader.getPythonFiles());
tableEnv.getConfig().getConfiguration().setString("python.client.executable", PropertyFileReader.getPythonClientExecutable());
tableEnv.getConfig().getConfiguration().setString("python.executable", PropertyFileReader.getPythonExecutable());
tableEnv.getConfig().getConfiguration().setString("taskmanager.memory.task.off-heap.size", "79mb");
// Registering Python UDF
tableEnv.executeSql("CREATE TEMPORARY SYSTEM FUNCTION Inference AS '" + PropertyFileReader.getPythonInferenceFunction() + "' LANGUAGE PYTHON");
the error appears at this line: StreamTableEnvironment tableEnv = StreamTableEnvironment.create(StreamingJob.env);
I'm using Flink 1.11 with
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-python_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
答案1
得分: 1
Flink不支持Java 9。此外,Java 9已经到了生命周期的尽头,不再支持任何生产用途。
请切换到Flink支持的版本,即Java 8或11。
英文:
Flink does not support Java 9. Moreover Java 9 is end of life and is not supported for any production use cases.
Please switch to either Java 8 or 11, which are the only supported version by Flink.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论