You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Steven Zhen Wu (Jira)" <ji...@apache.org> on 2022/11/27 20:54:00 UTC

[jira] [Comment Edited] (FLINK-30035) ./bin/sql-client.sh won't import external jar into the session

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

Steven Zhen Wu edited comment on FLINK-30035 at 11/27/22 8:53 PM:
------------------------------------------------------------------

[~fsk119] here are the steps to reproduce.

* download the [iceberg-flink-runtime jar|https://repository.apache.org/content/repositories/orgapacheiceberg-1114/org/apache/iceberg/iceberg-flink-runtime-1.16/1.1.0/iceberg-flink-runtime-1.16-1.1.0.jar] without putting it into  Flink`lib` dir
* start sql-client: ` ./bin/sql-client.sh embedded --jar /path/to/iceberg-flink-runtime-1.16-1.1.0.jar`
* run SQL cmd
{code}
CREATE CATALOG hadoop_catalog WITH (
  'type'='iceberg',
  'catalog-type'='hadoop',
  'warehouse'='file:/Users/stevenwu/runtime/hdfs',
  'property-version'='1'
);
{code}

Then we shall see exception
{code}
[ERROR] Could not execute SQL statement. Reason:
java.lang.NoSuchMethodException: Cannot find constructor for interface org.apache.iceberg.catalog.Catalog
	Missing org.apache.iceberg.hadoop.HadoopCatalog [java.lang.ClassNotFoundException: org.apache.iceberg.hadoop.HadoopCatalog]
{code}

Now if we put the jar inside Flink `lib/` dir. the external jar was loaded fine. The same SQL cmd will execute fine.
{code}
cp /path/to/iceberg-flink-runtime-1.16-1.1.0.jar lib/
./bin/sql-client.sh embedded
{code}



was (Author: stevenz3wu):
[~fsk119] here are the steps to reproduce.

* download the [iceberg-flink-runtime jar|https://repository.apache.org/content/repositories/orgapacheiceberg-1114/org/apache/iceberg/iceberg-flink-runtime-1.16/1.1.0/iceberg-flink-runtime-1.16-1.1.0.jar] without putting it into  Flink`lib` dir
* start sql-client: ` ./bin/sql-client.sh embedded --jar /path/to/iceberg-flink-runtime-1.16-1.1.0.jar`
* run SQL cmd
```
CREATE CATALOG hadoop_catalog WITH (
  'type'='iceberg',
  'catalog-type'='hadoop',
  'warehouse'='file:/Users/stevenwu/runtime/hdfs',
  'property-version'='1'
);
```

Then we shall see exception
```
[ERROR] Could not execute SQL statement. Reason:
java.lang.NoSuchMethodException: Cannot find constructor for interface org.apache.iceberg.catalog.Catalog
	Missing org.apache.iceberg.hadoop.HadoopCatalog [java.lang.ClassNotFoundException: org.apache.iceberg.hadoop.HadoopCatalog]
```

Now if we put the jar inside Flink `lib/` dir. the external jar was loaded fine. The same SQL cmd will execute fine.
```
cp /path/to/iceberg-flink-runtime-1.16-1.1.0.jar lib/
./bin/sql-client.sh embedded
```


> ./bin/sql-client.sh won't import external jar into the session
> --------------------------------------------------------------
>
>                 Key: FLINK-30035
>                 URL: https://issues.apache.org/jira/browse/FLINK-30035
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Client
>    Affects Versions: 1.16.0
>            Reporter: Steven Zhen Wu
>            Priority: Major
>
> I used to be able to run the sql-client with iceberg-flink-runtime jar using the `-j,--jar <JAR file>` option (e.g. with 1.15.2). 
> {code}
> ./bin/sql-client.sh embedded --jar iceberg-flink-runtime-1.16-1.1.0.jar
> {code}
> With 1.16.0, this doesn't work anymore. As a result, I am seeing ClassNotFoundException.
> {code}
> java.lang.ClassNotFoundException: org.apache.iceberg.hadoop.HadoopCatalog
> {code}
> I have to put the iceberg-flink-runtime-1.16-1.1.0.jar file inside the `flink/lib` directory to make the jar loaded. This seems like a regression of 1.16.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)