JGeometry.store Throws SQLException Connection Closed After Several Hours (Doc ID 1476247.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Spatial - Version 11.2.0.3 and later
Information in this document applies to any platform.

Symptoms

After several hours of successful operation, the following method begins encountering errors on the call to JGeometry.store.

  private STRUCT getShapeStruct(GeometricGeofence geofence)
  {
  // get the shape from the geofence
  GeodesicShape shape = getShape(geofence);
  JGeometry j_geom;
  try
  {
  j_geom = JGeometryTranslator.toGeom(shape);
  }
  catch (TranslationException e)
  {
  log.error(e.getMessage());
  return null;
  }

  Connection ocon = null;
  if (dataSourceConnection instanceof weblogic.utils.wrapper.Wrapper)
  {
  weblogic.utils.wrapper.Wrapper jtsConnection = (weblogic.utils.wrapper.Wrapper) dataSourceConnection;
  ocon = (Connection) jtsConnection.getVendorObj();
  }
  else if (dataSourceConnection instanceof DelegatingConnection)
  {
  ocon = ((DelegatingConnection) dataSourceConnection).getInnermostDelegate();
  }
  if (j_geom == null || ocon == null)
  {
  log.error("Unable to get innermost delegate connection to convert shape.");
  return null;
  }
  else
  {
  try
  {
  return JGeometry.store(j_geom, ocon);
  }
  catch (SQLException e)
  {
  log.error(e.getMessage());
  return null;
  }
  }
  }


The stack trace of the SQLException is as follows
Closed Connection
oracle.jdbc.driver.PhysicalConnection.prepareCall(PhysicalConnection.java:3623)
oracle.jdbc.driver.PhysicalConnection.prepareCall(PhysicalConnection.java:3584)
oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:532)
oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:470)
oracle.sql.StructDescriptor.initPickler(StructDescriptor.java:392)
oracle.sql.StructDescriptor.(StructDescriptor.java:322)
oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:203)
oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:171)
oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:140)
oracle.spatial.geometry.JGeometry.createDBDescriptors(JGeometry.java:2997)
oracle.spatial.geometry.JGeometry.store(JGeometry.java:2902)


Following advice from Oracle forums, the following has been attempted to resolve this issue:
• Set accessToUnderlyingConnections=true in the data source’s connection pool properties.
• Set Remove Infected Connections Enabled to false in the data source’s connection pool.
• Extend JGeometry to add synchronized calls clearing database descriptors as described here: https://forums.oracle.com/forums/thread.jspa?threadID=378572
None of these attempts has resolved the issue.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms