[ 
https://issues.apache.org/jira/browse/FLINK-20109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17231368#comment-17231368
 ] 

xuhaoran commented on FLINK-20109:
----------------------------------

sorry [~hailong wang]

[https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/sqlClient.html]

I dont do like this . start client like bin/sql-client.sh embedded,

but I put the jar flink-sql-connector-kafka_2.11-1.11.2.jar in the lib,and I 
try to restart cluster , ps-ef |grep flink 

I see 

/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java 
-Xmx1073741824 -Xms1073741824 -XX:MaxMetaspaceSize=268435456 
-Dlog.file=/usr/local/Cellar/apache-flink/1.11.2/libexec/log/flink-xuhaoran-standalonesession-0-xuhaorandeMacBook-Pro.local.log
 
-Dlog4j.configuration=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/log4j.properties
 
-Dlog4j.configurationFile=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/log4j.properties
 
-Dlogback.configurationFile=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/logback.xml
 -classpath 
/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-connector-jdbc_2.11-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-csv-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-json-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-shaded-zookeeper-3.4.14.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-sql-connector-kafka_2.11-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-table-blink_2.12-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-table_2.12-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-1.2-api-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-api-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-core-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-slf4j-impl-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-dist_2.12-1.11.2.jar:::
 org.apache.flink.runtime.entrypoint.StandaloneSessionClusterEntrypoint 
--configDir /usr/local/Cellar/apache-flink/1.11.2/libexec/conf --executionMode 
cluster

I think the jar should be avalible flink-sql-connector-kafka_2.11-1.11.2.jar

then I start the cli 

/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java 
-Dlog.file=/usr/local/Cellar/apache-flink/1.11.2/libexec/log/flink-xuhaoran-sql-client-xuhaorandeMacBook-Pro.local.log
 
-Dlog4j.configuration=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/log4j-cli.properties
 
-Dlog4j.configurationFile=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/log4j-cli.properties
 
-Dlogback.configurationFile=file:/usr/local/Cellar/apache-flink/1.11.2/libexec/conf/logback.xml
 -classpath 
/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-connector-jdbc_2.11-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-csv-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-json-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-shaded-zookeeper-3.4.14.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-sql-connector-kafka_2.11-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-table-blink_2.12-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-table_2.12-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-1.2-api-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-api-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-core-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/log4j-slf4j-impl-2.12.1.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/lib/flink-dist_2.12-1.11.2.jar:/usr/local/Cellar/apache-flink/1.11.2/libexec/opt/flink-python_2.12-1.11.2.jar::::/usr/local/Cellar/apache-flink/1.11.2/libexec/opt/flink-sql-client_2.12-1.11.2.jar
 org.apache.flink.table.client.SqlClient embedded --jar 
/usr/local/Cellar/apache-flink/1.11.2/libexec/opt/flink-sql-client_2.12-1.11.2.jar

you can still see flink-sql-connector-kafka_2.11-1.11.2.jar in the classpath 

But when I create kafka table ,and just try to select * from table , Could not 
execute SQL statement. Reason:
java.lang.ClassNotFoundException: 
org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer

 

I vim the jar ,the class is in the flink-sql-connector-kafka_2.11-1.11.2.jar 

> java.lang.ClassNotFoundException: 
> org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
> ------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-20109
>                 URL: https://issues.apache.org/jira/browse/FLINK-20109
>             Project: Flink
>          Issue Type: Bug
>          Components: Client / Job Submission
>    Affects Versions: 1.11.2
>         Environment: macos 10.14.6 
> flink 1.11.2
>            Reporter: xuhaoran
>            Priority: Major
>
> 按照官网例子 加载Kafka的连接器需要下载flink-sql-connector-kafka_2.11-1.11.2.jar
> 然后启动指令为./sql-client.sh embedded -lib xxx/ 
> 然后创建简单的sql语句 创建 Kafka table 
> 执行都ok
>  
> 但如果flink-sql-connector-kafka_2.11-1.11.2.jar 放在classpath里面  启动./sql-client.sh 
> embedded ps -ef|grep java 
> 也可以看到当前classpath加载了flink-sql-connector-kafka_2.11-1.11.2.jar
> 执行之前的创建kafka table 执行select * from table 
> 报错java.lang.ClassNotFoundException: 
> org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
> 怀疑类加载器有问题
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to