这报错信息没几句,光代码看不出来啥的。
liuyehan <[email protected]> 于2021年11月11日周四 上午9:54写道:
> 您好!
>
>
> 感谢您百忙之中抽空看我邮件;
> 目前问题:
> 使用看flink 1.10官网 hive部分,出现了Exception in thread "main"
> java.lang.IncompatibleClassChangeError: Implementing class
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
>
>
> pom.xml:
> <dependency>
> <groupId>org.apache.flink</groupId>
> <artifactId>flink-connector-hive_2.11</artifactId>
> <version>1.10.2</version>
> <scope>provided</scope>
> </dependency>
>
> <dependency>
> <groupId>org.apache.flink</groupId>
> <artifactId>flink-table-api-java-bridge_2.11</artifactId>
> <version>1.10.2</version>
> <scope>provided</scope>
> </dependency>
>
> <!-- Hive Dependency -->
> <dependency>
> <groupId>org.apache.hive</groupId>
> <artifactId>hive-exec</artifactId>
> <version>2.1.0</version>
> <scope>provided</scope>
> </dependency>
>
>
> 代码:
> EnvironmentSettings settings =
> EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build();
> TableEnvironment tableEnv = TableEnvironment.create(settings);
>
> //EnvironmentSettings settings =
> EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build();
>
> // TableEnvironment tableEnv = TableEnvironment.create(settings);
>
> String name = "myhive";
> String defaultDatabase = "default";
> String hiveConfDir = "/export/server/hive-2.1.0/conf";
>
> HiveCatalog hive = new HiveCatalog(name, defaultDatabase,
> hiveConfDir,"2.1.0");
> tableEnv.registerCatalog("myhive", hive);
>
> // set the HiveCatalog as the current catalog of the session
> tableEnv.useCatalog("myhive");
> Table result = tableEnv.sqlQuery("select * from exp_2_mysql_table limit
> 10");
> result.printSchema();
>
> tableEnv.execute("Flink SQL");
>
>
>
>
>
>
>
>
>