snowflakedb/snowflake-jdbc

SNOW-1008792: since 3.13.19 , I can not package the snowflake-jdbc into my fat jar

Closed this issue · 2 comments

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of JDBC driver are you using?
    3.13.18 working, after that version , I fails

  2. What operating system and processor architecture are you using?
    I use window to complies this.

  3. What version of Java are you using?
    I use zulu-1.8 (1.9.0_392)

  4. What did you do?
    I this below pom to package snowflake jdbc in to a fat jar, it throw me the error Unsupported class file major version 59

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

 <groupId>com.uprr.azure</groupId>
 <artifactId>snowflake-streaming</artifactId>
 <version>1.0.0</version>

 <properties>
   <jdk.version>1.8</jdk.version>
 </properties>

 <dependencies>
   <dependency>
     <groupId>net.snowflake</groupId>
     <artifactId>snowflake-ingest-sdk</artifactId>
     <version>2.0.3</version>
     <exclusions>
       <exclusion>
       <groupId>net.snowflake</groupId>
       <artifactId>snowflake-jdbc</artifactId>
       </exclusion>
     </exclusions>
   </dependency>
   <dependency>
     <groupId>net.snowflake</groupId>
     <artifactId>snowflake-jdbc</artifactId>
     <version>3.14.4</version>
   </dependency>
   <dependency>
     <groupId>org.apache.spark</groupId>
     <artifactId>spark-sql_2.12</artifactId>
     <scope>provided</scope>
     <version>3.4.1</version>
   </dependency>
 </dependencies>

 <build>
 <plugins>
   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>3.11.0</version>
       <configuration>
         <source>${jdk.version}</source>
         <target>${jdk.version}</target>
       </configuration>
     </plugin>
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-shade-plugin</artifactId>
     <version>3.2.1</version>
     <executions>
       <execution>
         <phase>package</phase>
         <goals>
           <goal>shade</goal>
         </goals>
         <configuration>
           <filters>
             <filter>
               <artifact>*:*</artifact>
               <excludes>
                 <exclude>META-INF/*.SF</exclude>
                 <exclude>META-INF/*.DSA</exclude>
                 <exclude>META-INF/*.RSA</exclude>
               </excludes>
             </filter>
           </filters>
           <relocations>
             <relocation>
               <pattern>net.snowflake.ingest</pattern>
               <shadedPattern>shade.com.net.snowflake.ingest</shadedPattern>
             </relocation>
           </relocations>
         </configuration>
       </execution>
     </executions>
   </plugin>
 </plugins>
 </build>
</project>	

After I remove it works fine,

<dependency>
      <groupId>net.snowflake</groupId>
      <artifactId>snowflake-jdbc</artifactId>
      <version>3.14.4</version>
    </dependency>
  1. What did you expect to see?
    if you change the snowflake-jdbc to 3.13.18, it works fine,
<dependency>
      <groupId>net.snowflake</groupId>
      <artifactId>snowflake-jdbc</artifactId>
      <version>3.13.18</version>
    </dependency>

when we use 3.13.19 or later, we get Unsupported class file major version 59

Hi @sunscorch
I tried to build using your pom.xml - indeed it causes the problem and it's because of Java 15 classes (or higher) from META-INF/versions:

META-INF/versions/15/org/bouncycastle/jcajce/provider/asymmetric/edec/SignatureSpi$Ed25519.class: java.lang.IllegalArgumentException: Unsupported class file major version 59

I found that to solve that you can use higher version of shade-maven-plugin e.g. 3.4.1 (as it is used in snowflake-jdbc)
It's not a bug in snowflake-jdbc

thanks a lot for your information, great help from your side