Loading
KNOWLEDGE BASE ARTICLES

Can't find what you're looking for? Ask The Community  

JDBC Driver throws NoClassDefFoundError for class RootAllocator in Arrow Library, while trying to run a select query

JDBC Driver throws java.lang.NoClassDefFoundError for class RootAllocator in Arrow Library, while trying to run a select query

May 8, 2025
Issue
When using the Snowflake JDBC driver to fetch results from Snowflake, the user may encounter the below exception in Java.
SQL Error [200001] [XX000]: JDBC driver internal error: exception creating result java.lang.NoClassDefFoundError: Could not initialize class net.snowflake.client.jdbc.internal.apache.arrow.memory.RootAllocator at net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1.create(SnowflakeResultSetSerializableV1.java:560).
An important point to note for the symptom is that this error is not seen with every show or select statement.  It is only encountered when the results are sent in Arrow format.
Cause
Snowflake JDBC Driver uses 'Arrow' as a result format while fetching or processing the results of a query sent to Snowflake. The default format was changed from 'JSON' to 'Arrow' a few years back (v3.11.0)

The error is normally encountered on operating systems that are not officially supported and tested for JDBC driver.  Client Version & Support Policy has the list of currently supported Operating Systems.

The underlying cause for the specific error message is that either the Arrow Library is not installed properly or is not supported on the operating system in question.
Solution

Snowflake JDBC driver can run on more Linux/Unix distributions than it is intended or tested for. Although Snowflake customer support does not handle any issues on an unsupported Operating System or unsupported Java (JVM) runtime, the customer may choose to run the driver on an unsupported platform after their internal testing and due diligence.

  1. The first step in fixing NoClassDefFoundError is to make sure that you are using the latest version of the JDBC driver. Our JDBC jar bundle should be self-sufficient with all arrow libraries embedded.
    For recent release information, refer to JDBC Driver release notes.
  2. If the latest version of the JDBC Driver has not helped, the next step is to override the default result format for JDBC by setting the property JDBC_QUERY_RESULT_FORMAT. The preferred way to set this property would be at the session or user level instead of at the account level.

    Example ALTER statements like these can be used to set the property at the account or user level.
ALTER ACCOUNT SET JDBC_QUERY_RESULT_FORMAT='JSON'; ALTER ACCOUNT UNSET JDBC_QUERY_RESULT_FORMAT; //To revert the change ALTER USER <user_name> SET JDBC_QUERY_RESULT_FORMAT='JSON'; ALTER USER <user_name> UNSET JDBC_QUERY_RESULT_FORMAT; //To revert the change


The property can be set at the session level, directly inside the Java code.  A simple example can be seen in the code below

Statement = connection.createStatement(); Statement.executeQuery("ALTER SESSION SET JDBC_QUERY_RESULT_FORMAT='JSON'");
Additional Information
Also see, SAP-BW-Java-lang-NoClassDefFoundError-for-Apache-arrow  for a similar error in SAP.  Although these are generated for different classes, they have a similar root cause.

© 2024 Snowflake Inc. All Rights Reserved | If you'd rather not receive future emails from Snowflake,
unsubscribe here or customize your communication preferences

Loading
JDBC Driver throws NoClassDefFoundError for class RootAllocator in Arrow Library, while trying to run a select query