Hello:

I am trying to fix the problem which was described in the message <http://osgeo-org.1560.x6.nabble.com/ImageMosaic-REST-API-with-DataStoreWrapper-td5312426.html>.

After debugging the process appends granules to the Oracle database, I suspect that OracleDatastoreWrapper continues to use the DefaultTransaction object after it was closed and the properties stateLookup, propertyLookup and authorizations were set equal to null. Therefore, IllegalStateException "Transaction has been closed" throws while the method getState of the DefaultTransaction object is invoking. The problem begins when the ContentState object "state" is created after invoking the method getState(Transaction transaction) of the ContentFeatureSource object with the closed transaction. Adding a "try catch" block to the body of the method getState(Transaction transaction) of the class ContentEntry has been proposed to solve the problem. The following is the new version of the method:

public ContentState getState(Transaction transaction) {
        if (transaction != null && state.containsKey(transaction)) {
            return state.get(transaction);
        } else {
            ContentState auto = state.get(Transaction.AUTO_COMMIT);
            ContentState copy = (ContentState) auto.copy();
            Transaction t = (transaction != null ? transaction : Transaction.AUTO_COMMIT);
+            try {
+           // we obtain IllegalStateException if propertyLookup is equal to null or +           // we obtain UnsupportedOperationException if t instanceof AutoCommitTransaction
+                t.getAuthorizations();
+            } catch (IllegalStateException ex) {
+                t = Transaction.AUTO_COMMIT; // change t to AutoCommitTransaction
+            } catch (UnsupportedOperationException ex) { // do nothing
+            }
            copy.setTransaction(t);
            state.put(t, copy);

            return copy;
        }
}

The code above lets to check if object transaction is instance of DefaultTransaction and it is closed. The granules were added to the database after rebuilding and updating the gt-data module. The question is still open. Is there a solution that allows to clear all pointers which point to the closed DefaultTransaction transaction? Such pointers have been found. Or should we use the proposed above modification of the getState method, which allows to block the creation of  the "state" object with the closed DefaultTransaction? English is not my native language, please excuse typing errors. Thank you.

I am using Geoserver 2.13.1, GeoTools 19.1.

datastore.properties:
SPI=org.geotools.data.oracle.OracleNGJNDIDataStoreFactory
jndiReferenceName=java:comp/env/jdbc/oracle
schema=schema_name

Loose\ bbox=true
Estimated\ extends=false
Connection\ timeout=10
preparedStatements=true

imgmosaic.properties:
Heterogeneous=false
TimeAttribute=time
AbsolutePath=true
Name=imgmosaic
HeterogeneousCRS=false
TypeName=imgmosaic
Caching=false
ExpandToRGB=false
LocationAttribute=location
CheckAuxiliaryMetadata=false
LevelsNum=1

indexer.xml:
...
   <parameters>
        <parameter name="AbsolutePath" value="true" />
        <parameter name="Caching" value="true" />
        <parameter name="CanBeEmpty" value="false" />
        <parameter name="IndexingDirectories" value="/path/to/geoserver/data/imgmosaic/epsg" />
        <parameter name="Name" value="imgmosaic" />
        <parameter name="Recursive" value="true" />
        <parameter name="TimeAttribute" value="time" />
    </parameters>
...

Looking forward to any suggestions,
best regards,

Ivan Martynovskyi


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to