I'm facing the strange issue during receiving blob field from oracle database: "SQLRecoverableException: Closed Connection
stack trace describing this exception:
java.sql.SQLRecoverableException: Closed Connection
at oracle.jdbc.driver.OracleBlob.getDBAccess(OracleBlob.java:960) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
at oracle.jdbc.driver.OracleBlob.getBinaryStream(OracleBlob.java:319) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
at oracle.jdbc.driver.OracleBlob.getBinaryStream(OracleBlob.java:300) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
at oracle.sql.BLOB.getBinaryStream(BLOB.java:316) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_221]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_221]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_221]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_221]
at org.hibernate.engine.jdbc.SerializableBlobProxy.invoke(SerializableBlobProxy.java:60) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]
at com.sun.proxy.$Proxy142.getBinaryStream(Unknown Source) ~[?:?]
at com.xxx.yyy.util.KeystoreHelper.loadKeyStore(KeystoreHelper.java:89) [cphcore-3.23.0.23-SNAPSHOT.jar:?]
at com.xxx.yyy.bp.job.substep.ProcessIF2Files.getChannelUnsealer(IFB2UnsealFiles.java:207) [classes/:?]
at com.xxx.yyy.bp.job.substep.ProcessIF2Files.access$4(IFB2UnsealFiles.java:198) [classes/:?]
at com.xxx.yyy.bp.job.substep.ProcessIF2Files$1.execute(IFB2UnsealFiles.java:86) [classes/:?]
at com.xxx.yyy.bp.job.substep.ProcessIF2Files$1.execute(IFB2UnsealFiles.java:1) [classes/:?]
source code: class KeystoreHelper method loadKeyStore:
(...)
Blob keystoreBlob = keystore.getKeystoreData();
if (keystoreBlob == null || keystoreBlob.length() == 0) {
log.error("Keystore data is empty");
throw new KeystoreAccessException(keystore, "Keystore data is empty", null);
}
inputStream = keystore.getKeystoreData().getBinaryStream(); // line 89 - Exception
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.close();
byte[] keystoreData = outputStream.toByteArray();
inputStream = new ByteArrayInputStream(keystoreData);
(...)
source code for variable - keystore, class DbKeystore (entity), method getKeystoreData:
(...)
private java.sql.Blob keystoreData;
public java.sql.Blob getKeystoreData() {
return this.keystoreData;
}
public void setKeystoreData(java.sql.Blob keystoreData) {
this.keystoreData = keystoreData;
}
(...)
Have any of you encountered a similar problem? Thanks for any help :)
keystore.getKeystoreData().getBinaryStream(). That's causing the exception. And unfortunately, "SQLRecoverableException" is masking the "real" exception. Q: Is getKeystoreData() in a custom class? A class that your organization wrote? Q: Can you step into that class with the debugger?