You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.22169
Client Operating System
Various: Windows 10 and Ubuntu 18.04.4 on AWS ("Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1023-aws x86_64)")
JAVA/JVM version
Various: OpenJDK Runtime Environment (build 14.0.1+7), OpenJDK-17_4, et al
Table schema
Not relevant
Problem description
The Redshift JDBC driver throws an ExceptionInInitializerError at initialization time when deployed as a part of our Tomcat webapp, see stack trace below. The problem is that DriverInfo calls getResourceAsStream("version.properties") (link) expecting to load version.properties from the root of its jar, but, in many cases, the classloader returns that resource from a different jar file. (In our case, it happens to return the version.properties resource from javacc-5.0.jar, but unfortunately many jars include this file at the root.) This leads to an NPE on line 44 which leads to an ExceptionInInitializerError, which makes the driver unusable in complex deployments. There is no workaround, other than removing every other jar file that includes version.properties at the root, which is not a viable option for us.
The fix should be simple: rename version.properties to something unique (redshift.properties?) and/or move it out of the root to a unique path such as com/amazon/redshift. I've created a custom version of the driver that gives the file a unique name and confirmed that it resolves the issue. Happy to provide additional information or a patch, if needed.
ERROR ExceptionUtil 2021-01-05T21:27:34,248 catalina-exec-9 : Unhandled exception: null
java.lang.ExceptionInInitializerError: null
at com.amazon.redshift.core.v3.ConnectionFactoryImpl.getParametersForStartup(ConnectionFactoryImpl.java:364) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:151) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.jdbc.RedshiftConnectionImpl.<init>(RedshiftConnectionImpl.java:283) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.Driver.makeConnection(Driver.java:456) ~[redshift-jdbc42-2.0.0.1.jar:?]
at com.amazon.redshift.Driver.connect(Driver.java:269) ~[redshift-jdbc42-2.0.0.1.jar:?]
at org.apache.tomcat.dbcp.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:55) ~[tomcat-dbcp.jar:9.0.36]
at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355) ~[tomcat-dbcp.jar:9.0.36]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:114) ~[tomcat-dbcp.jar:9.0.36]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:664) ~[tomcat-dbcp.jar:9.0.36]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:543) ~[tomcat-dbcp.jar:9.0.36]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:752) ~[tomcat-dbcp.jar:9.0.36]
at org.labkey.api.data.DbScope.<init>(DbScope.java:309) ~[api-21.2-SNAPSHOT.jar:?]
at org.labkey.api.data.DbScope.addScope(DbScope.java:1446) ~[api-21.2-SNAPSHOT.jar:?]
at org.labkey.api.data.DbScope.initializeScopes(DbScope.java:1415) ~[api-21.2-SNAPSHOT.jar:?]
at org.labkey.api.data.DbScope.initializeDataSources(DbScope.java:1259) ~[api-21.2-SNAPSHOT.jar:?]
at org.labkey.api.module.ModuleLoader.doInit(ModuleLoader.java:471) ~[api-21.2-SNAPSHOT.jar:?]
at org.labkey.api.module.ModuleLoader.init(ModuleLoader.java:225) ~[api-21.2-SNAPSHOT.jar:?]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:102) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4528) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1830) ~[catalina.jar:9.0.36]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.36]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118) ~[?:?]
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[catalina.jar:9.0.36]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.36]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[?:?]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.36]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) ~[catalina.jar:9.0.36]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.36]
at org.apache.catalina.startup.Catalina.start(Catalina.java:633) ~[catalina.jar:9.0.36]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343) ~[bootstrap.jar:9.0.36]
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474) ~[bootstrap.jar:9.0.36]
Caused by: java.lang.NullPointerException
at com.amazon.redshift.util.DriverInfo.<clinit>(DriverInfo.java:44) ~[redshift-jdbc42-2.0.0.1.jar:?]
... 63 more
JDBC trace logs
Reproduction code
The text was updated successfully, but these errors were encountered:
2.0.0.3 version looks great locally and with our continuous integration test suites. We'll test shortly on production servers as well, but I suspect all is good.
Thank you for making this fix. And, in general, for all the improvements in 2.0.0.x (GitHub availability, license, dependencies, etc.). They make it much easier for systems like ours to integrate with Redshift.
Driver version
2.0.0.1
Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.22169
Client Operating System
Various: Windows 10 and Ubuntu 18.04.4 on AWS ("Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1023-aws x86_64)")
JAVA/JVM version
Various: OpenJDK Runtime Environment (build 14.0.1+7), OpenJDK-17_4, et al
Table schema
Not relevant
Problem description
The Redshift JDBC driver throws an
ExceptionInInitializerError
at initialization time when deployed as a part of our Tomcat webapp, see stack trace below. The problem is thatDriverInfo
callsgetResourceAsStream("version.properties")
(link) expecting to loadversion.properties
from the root of its jar, but, in many cases, the classloader returns that resource from a different jar file. (In our case, it happens to return theversion.properties
resource from javacc-5.0.jar, but unfortunately many jars include this file at the root.) This leads to an NPE on line 44 which leads to anExceptionInInitializerError
, which makes the driver unusable in complex deployments. There is no workaround, other than removing every other jar file that includesversion.properties
at the root, which is not a viable option for us.The fix should be simple: rename
version.properties
to something unique (redshift.properties
?) and/or move it out of the root to a unique path such as com/amazon/redshift. I've created a custom version of the driver that gives the file a unique name and confirmed that it resolves the issue. Happy to provide additional information or a patch, if needed.JDBC trace logs
Reproduction code
The text was updated successfully, but these errors were encountered: