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
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).
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.
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.
- 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. - 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'");