Alter
Alter

Reputation: 1213

Illegal access to create StreamTableEnvironment with JDK 9 in debian

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>

Upvotes: 0

Views: 151

Answers (1)

Dawid Wysakowicz
Dawid Wysakowicz

Reputation: 3422

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.

Upvotes: 1

Related Questions