Flink SQL 创建 TableEnvironment 对象失败

Flink新手在使用示例创建  TableEnvironment 或者 StreamTableEnvironment 对象时(IFDE环境下),很有可能会遇到如下错误:

Exception in thread "main" org.apache.flink.table.api.NoMatchingTableFactoryException: Could not find a suitable table factory for 'org.apache.flink.table.delegation.ExecutorFactory' in the classpath.

Reason: No factory implements 'org.apache.flink.table.delegation.ExecutorFactory'.


打开项目的pom.xml文件,对照  flink-table-planner-blink_XXX, 修改其属性标签 .

            <!-- <scope>provided</scope> -->

删除或注释掉   <scope>provided</scope> 标签.


  • compile

    This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.(Compile means that you need the JAR for compiling and running the app. For a web application, as an example, the JAR will be placed in the WEB-INF/lib directory.)

  • provided

    This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.(Provided means that you need the JAR for compiling, but at run time there is already a JAR provided by the environment so you don't need it packaged with your app. For a web app, this means that the JAR file will not be placed into the WEB-INF/lib directory.)

For a web app, if the app server already provides the JAR (or its functionality), then use "provided" otherwise use "compile".

©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
钱包余额 0