SNOW-1423466: Snowflake JDBC driver not working with Spring Boot 3.2.0 (Throws NegativeArraySizeException)
Closed this issue · 6 comments
Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!
-
What version of JDBC driver are you using?
Starting from 3.14.0, this issue is coming -
What operating system and processor architecture are you using?
Windows 11 -
What version of Java are you using?
Java 17 -
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.I recently upgraded my project from Spring boot 2 to Spring boot 3, this exception started to come after that.
-
What did you expect to see?
What should have happened and what happened instead?
My application should have started without any issue, but failing to even load at boot. Below is the exception:
Exception in thread "main" java.lang.NegativeArraySizeException: -31736
at org.springframework.boot.loader.zip.ZipContent$Loader.<init>(ZipContent.java:435)
at org.springframework.boot.loader.zip.ZipContent$Loader.loadContent(ZipContent.java:565)
at org.springframework.boot.loader.zip.ZipContent$Loader.openAndLoad(ZipContent.java:543)
at org.springframework.boot.loader.zip.ZipContent$Loader.loadNestedZip(ZipContent.java:537)
at org.springframework.boot.loader.zip.ZipContent$Loader.load(ZipContent.java:522)
at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:372)
at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:361)
at org.springframework.boot.loader.jar.NestedJarFileResources.<init>(NestedJarFileResources.java:57)
at org.springframework.boot.loader.jar.NestedJarFile.<init>(NestedJarFile.java:141)
at org.springframework.boot.loader.jar.NestedJarFile.<init>(NestedJarFile.java:120)
at org.springframework.boot.loader.net.protocol.jar.UrlNestedJarFile.<init>(UrlNestedJarFile.java:42)
at org.springframework.boot.loader.net.protocol.jar.UrlJarFileFactory.createJarFileForNested(UrlJarFileFactory.java:86)
at org.springframework.boot.loader.net.protocol.jar.UrlJarFileFactory.createJarFile(UrlJarFileFactory.java:55)
at org.springframework.boot.loader.net.protocol.jar.UrlJarFiles.getOrCreate(UrlJarFiles.java:72)
at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.connect(JarUrlConnection.java:289)
at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.getJarFile(JarUrlConnection.java:99)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.getJarFile(JarUrlClassLoader.java:185)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackage(JarUrlClassLoader.java:143)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackageIfNecessary(JarUrlClassLoader.java:126)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:99)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:88)
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
-
Can you set logging to DEBUG and collect the logs?
https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors
The application doesn't even load the class files at the startup, it fails when Spring Boot 3 tried to load class so debug logs gets created. The same upgrade is working 3.13.34 but giving me another error
Illegal char <:> at index 6:sf_client_config.json
-
What is your Snowflake account identifier, if any? (Optional)
@dsinghal-nice I'm not sure this is necessarily a JDBC driver issue. That exception you're sharing looks like an issue with Spring boot's code when it's trying to unpack the JARs on the classpath looking for a class to load:
Exception in thread "main" java.lang.NegativeArraySizeException: -31736
at org.springframework.boot.loader.zip.ZipContent$Loader.<init>(ZipContent.java:435)
at org.springframework.boot.loader.zip.ZipContent$Loader.loadContent(ZipContent.java:565)
at org.springframework.boot.loader.zip.ZipContent$Loader.openAndLoad(ZipContent.java:543)
I did a quick search in their project and I see the following issue which seems to be the problem you're running into:
spring-projects/spring-boot#38572
Can you refer to the conversation there and see if there's anything in there that can help you address the problem? If not, then I would suggest you first raise this issue with the Spring Boot team. If they need any information or they suspect there's a problem with our JAR, then just let us know and we'll take a look.
Hi @sfc-gh-wfateem,
The snowflake-jdbc version (3.14.1) with Spring Boot 3.2.0 has this issue, and with Spring Boot 3.2.5 it is throwing another exception:
ERROR c.n.s.w.q.a.ser.utils.SnowflakeCommonUtils [] [] [] [] [] Error connecting to Snowflake:
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Illegal char <:> at index 6: nested:\C:\Deepak\CXBI\workspace\ms-cxcv-query-engine\impl\target\cxcv-query-engine-impl-1.0.0-SNAPSHOT.jar!BOOT-INF\lib\sf_client_config.json
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100)
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:81)
@dsinghal-nice Do you know what you have in this file?
C:\Deepak\CXBI\workspace\ms-cxcv-query-engine\impl\target\cxcv-query-engine-impl-1.0.0-SNAPSHOT.jar!BOOT-INF\lib\sf_client_config.json
@sfc-gh-wfateem, I checked the .jar, this file doesn't even exist at the location.
With version 3.13.30 this error does not come when I use Spring Boot 3.2.5. With version above 3.13.30 it starts to come.
This looks like the same issue mentioned here:
#1651 (comment)
Thanks !! @sfc-gh-dszmolka