Description
Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below error intermittently which is a possible thread synchronization issue with Velocity Engine. The resultset is getting closed while another thread is making use of it.
2023-04-15 10:36:33.472 ERROR [org.apache.velocity.loader.ds] {344} - DataSourceResourceLoader: database problem while getting timestamp of 'xyz_abc': java.sql.SQLException: Closed Resultset: next at oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109) ~[ojdbc8.jar:12.2.0.1.0] at oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398) ~[ojdbc8.jar:12.2.0.1.0] at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown Source) ~[CodeGenerator.class:12.2.1.3] at org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656) ~[velocity-engine-core-2.3.jar:2.3] at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) ~[velocity-engine-core-2.3.jar:2.3]
Reference:
https://stackoverflow.com/questions/2794167/is-resultset-thread-safe