flink sql 1.12 写数据到elasticsearch,部署问题

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

flink sql 1.12 写数据到elasticsearch,部署问题

cljbest@163.com
hi,
    flink sql 1.12版本,写数据到elasticsearch时,本地执行正常,部署到服务器上,报如下错误。
    检查了打的jar包,里面是包含相应的类的,在flink lib下也已经放了flink-connector-elasticsearch7_2.11-1.12.0.jar 包。
    调整了类的加载,试了child-first和parent-first都不行
    有遇到类似问题的吗?
谢谢!

错误提示如下:

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Could not load service provider for table factories.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:330)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:743)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:242)
at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:971)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1047)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1685)
at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1047)
Caused by: org.apache.flink.table.api.TableException: Could not load service provider for table factories.
at org.apache.flink.table.factories.TableFactoryService.discoverFactories(TableFactoryService.java:218)
at org.apache.flink.table.factories.TableFactoryService.findAllInternal(TableFactoryService.java:170)
at org.apache.flink.table.factories.TableFactoryService.findAll(TableFactoryService.java:125)
at org.apache.flink.table.factories.ComponentFactoryService.find(ComponentFactoryService.java:48)
at org.apache.flink.table.api.internal.TableEnvironmentImpl.create(TableEnvironmentImpl.java:263)
at org.apache.flink.table.api.TableEnvironment.create(TableEnvironment.java:90)
at com.searchrec.main.XfkEsIndex.main(XfkEsIndex.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:316)
... 11 more
Caused by: java.util.ServiceConfigurationError: org.apache.flink.table.factories.TableFactory: Provider org.apache.flink.streaming.connectors.elasticsearch7.Elasticsearch7UpsertTableSinkFactory could not be instantiate
d at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at org.apache.flink.table.factories.TableFactoryService.discoverFactories(TableFactoryService.java:214)
... 22 more
Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/common/xcontent/XContentType
at org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchUpsertTableSinkFactoryBase.<clinit>(ElasticsearchUpsertTableSinkFactoryBase.java:105)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 26 more
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.common.xcontent.XContentType
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 more




[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: flink sql 1.12 写数据到elasticsearch,部署问题

Yangze Guo
需要放 flink-sql-connector-elasticsearch7_2.11-1.12.0.jar

Best,
Yangze Guo

On Wed, Dec 16, 2020 at 11:34 AM [hidden email] <[hidden email]> wrote:

>
> hi,
>     flink sql 1.12版本,写数据到elasticsearch时,本地执行正常,部署到服务器上,报如下错误。
>     检查了打的jar包,里面是包含相应的类的,在flink lib下也已经放了flink-connector-elasticsearch7_2.11-1.12.0.jar 包。
>     调整了类的加载,试了child-first和parent-first都不行
>     有遇到类似问题的吗?
> 谢谢!
>
> 错误提示如下:
>
> org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Could not load service provider for table factories.
> at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:330)
> at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
> at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
> at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:743)
> at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:242)
> at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:971)
> at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1047)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1685)
> at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
> at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1047)
> Caused by: org.apache.flink.table.api.TableException: Could not load service provider for table factories.
> at org.apache.flink.table.factories.TableFactoryService.discoverFactories(TableFactoryService.java:218)
> at org.apache.flink.table.factories.TableFactoryService.findAllInternal(TableFactoryService.java:170)
> at org.apache.flink.table.factories.TableFactoryService.findAll(TableFactoryService.java:125)
> at org.apache.flink.table.factories.ComponentFactoryService.find(ComponentFactoryService.java:48)
> at org.apache.flink.table.api.internal.TableEnvironmentImpl.create(TableEnvironmentImpl.java:263)
> at org.apache.flink.table.api.TableEnvironment.create(TableEnvironment.java:90)
> at com.searchrec.main.XfkEsIndex.main(XfkEsIndex.java:24)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:316)
> ... 11 more
> Caused by: java.util.ServiceConfigurationError: org.apache.flink.table.factories.TableFactory: Provider org.apache.flink.streaming.connectors.elasticsearch7.Elasticsearch7UpsertTableSinkFactory could not be instantiate
> d at java.util.ServiceLoader.fail(ServiceLoader.java:232)
> at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
> at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
> at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
> at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
> at java.util.Iterator.forEachRemaining(Iterator.java:116)
> at org.apache.flink.table.factories.TableFactoryService.discoverFactories(TableFactoryService.java:214)
> ... 22 more
> Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/common/xcontent/XContentType
> at org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchUpsertTableSinkFactoryBase.<clinit>(ElasticsearchUpsertTableSinkFactoryBase.java:105)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> at java.lang.Class.newInstance(Class.java:442)
> at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
> ... 26 more
> Caused by: java.lang.ClassNotFoundException: org.elasticsearch.common.xcontent.XContentType
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 33 more
>
>
>
>
> [hidden email]