I am trying to get the Java session example for Snowflake to work as described in the developer guide, but have not had success. Expected behavior is that a session is created and the contents of the INFORMATION_SCHEMA.TABLES
table is output to the terminal. The code from the developer documentation is as follows:
import com.snowflake.snowpark_java.*;
import java.util.HashMap;
import java.util.Map;
public class snowpark {
public static void main(String[] args) {
Map<String, String> properties = new HashMap<>();
properties.put("URL", "https://**********");
properties.put("USER", "JOHN");
properties.put("PASSWORD", "********");
properties.put("ROLE", "DBA_CITIBIKE");
properties.put("WAREHOUSE", "LOAD_WH");
properties.put("DB", "CITIBIKE");
properties.put("SCHEMA", "DEMO");
SessionBuilder builder = Session.builder();
Session session = Session.builder().configs(properties).create();
I have modified the code to include attributes that are relevant to my environment. This code compiles just fine. However, when I run it I am presented with the following error:
RonaldCoeJrsMBP:_Dev ron$ java snowpark
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Option
at com.snowflake.snowpark_java.SessionBuilder.<init>(SessionBuilder.java:17)
at com.snowflake.snowpark_java.Session.builder(Session.java:52)
at snowpark.main(snowpark.java:15)
Caused by: java.lang.ClassNotFoundException: scala.Option
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 3 more
I have tried installing Scala and including its location in my path--one thing to note here is that there is no such file on my system called scala-library.jar
. I have successfully executed the developer example that is written in Python.