非法访问,在Debian中使用JDK 9创建StreamTableEnvironment

huangapple go评论122阅读模式
英文:

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 &quot;main&quot; java.lang.ExceptionInInitializerError
        at org.apache.flink.table.planner.calcite.FlinkRelFactories$.&lt;init&gt;(FlinkRelFactories.scala:51)
        at org.apache.flink.table.planner.calcite.FlinkRelFactories$.&lt;clinit&gt;(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.&lt;init&gt;(PlannerContext.java:113)
        at org.apache.flink.table.planner.delegation.PlannerBase.&lt;init&gt;(PlannerBase.scala:112)
        at org.apache.flink.table.planner.delegation.StreamPlanner.&lt;init&gt;(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.&lt;clinit&gt;(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(&quot;python.files&quot;, PropertyFileReader.getPythonFiles());
            tableEnv.getConfig().getConfiguration().setString(&quot;python.client.executable&quot;, PropertyFileReader.getPythonClientExecutable());
            tableEnv.getConfig().getConfiguration().setString(&quot;python.executable&quot;, PropertyFileReader.getPythonExecutable());
            tableEnv.getConfig().getConfiguration().setString(&quot;taskmanager.memory.task.off-heap.size&quot;, &quot;79mb&quot;);
            // Registering Python UDF
            tableEnv.executeSql(&quot;CREATE TEMPORARY SYSTEM FUNCTION Inference AS &#39;&quot; + PropertyFileReader.getPythonInferenceFunction() + &quot;&#39; LANGUAGE PYTHON&quot;);

the error appears at this line: StreamTableEnvironment tableEnv = StreamTableEnvironment.create(StreamingJob.env);

I'm using Flink 1.11 with

&lt;dependency&gt;
            &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
            &lt;artifactId&gt;flink-table-planner-blink_2.11&lt;/artifactId&gt;
            &lt;version&gt;${flink.version}&lt;/version&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
            &lt;artifactId&gt;flink-python_2.11&lt;/artifactId&gt;
            &lt;version&gt;${flink.version}&lt;/version&gt;
        &lt;/dependency&gt;

答案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.

huangapple
  • 本文由 发表于 2020年10月27日 04:20:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/64544422.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定