Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35732

sql-client.sh fails with ClassNotFoundException depending on its location

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.19.1
    • None
    • Deployment / Scripts
    • None

    Description

      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:

      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
      

      It also fails if the distribution is placed in a directory named `my-flink-sql-client-project`, with stacktrace:

      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
      

      I think this is caused by the regexes 1 2 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            robyoung Rob Young
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: