Rob Young created FLINK-35732: --------------------------------- Summary: flink-sql-client.sh fails with ClassNotFoundException depending on it's location Key: FLINK-35732 URL: https://issues.apache.org/jira/browse/FLINK-35732 Project: Flink Issue Type: Bug Components: Deployment / Scripts Affects Versions: 1.19.1 Reporter: Rob Young
To reproduce: 1. create a directory `mkdir my-flink-sql-gateway-project` 2. unpack a flink binary distribution inside that directory 3. run `./my-flink-sql-gateway-project/flink-1.19.1/bin/sql-client.sh Expected: the SQL console starts Actual: fails with stack trace: {code:java} Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue. at org.apache.flink.table.client.SqlClient.startClient(SqlClient.java:242) at org.apache.flink.table.client.SqlClient.main(SqlClient.java:179) Caused by: java.lang.NoClassDefFoundError: org/apache/flink/table/gateway/service/context/DefaultContext at org.apache.flink.table.client.gateway.DefaultContextUtils.buildDefaultContext(DefaultContextUtils.java:57) at org.apache.flink.table.client.SqlClient.start(SqlClient.java:106) at org.apache.flink.table.client.SqlClient.startClient(SqlClient.java:228) ... 1 more Caused by: java.lang.ClassNotFoundException: org.apache.flink.table.gateway.service.context.DefaultContext at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ... 4 more {code} It also fails if the distribution is placed in a directory named `my-flink-sql-client-project`, with stacktrace: {code:java} Error: Could not find or load main class org.apache.flink.table.client.SqlClient Caused by: java.lang.ClassNotFoundException: org.apache.flink.table.client.SqlClient {code} I think this is caused by the regexes[[1|https://github.com/apache/flink/blob/master/flink-table/flink-sql-client/bin/sql-client.sh#L71]][[2|https://github.com/apache/flink/blob/e7d7db3b6f87e53d9bace2a16cf95e5f7a79087a/flink-table/flink-sql-client/bin/sql-client.sh#L81]] matching all the jars in the lib dir unexpectedly. It looks like it would also be a problem if the flink distribution was contained in a dir named `my-flink-python-project` and you needed flink-python on the classpath. -- This message was sent by Atlassian Jira (v8.20.10#820010)