[OracleDatastore] JGeometry.store issue

8 messages Options
Embed this post
Permalink
Reijer Copier

[OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi,

I recently configured a deegree WFS using two different Oracle
databases. Everything seemed to work as expected. Unfortunately I
encountered a very strange problem while performing GetFeature requests
including a BBOX filter. Only the feature types of one of the databases
where accessible. The other requests resulted in the following
(confusing) exception:

org.deegree.io.datastore.DatastoreException: SQL error while performing
query: Cannot construct ARRAY instance, invalid connection
    at
org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
    at
org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
    at
org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
    at
org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
invalid connection
    at oracle.sql.ARRAY.<init>(ARRAY.java:123)
    at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
    at
org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
    at
org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
    at
org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
    at
org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)

On the oracle forums I found this thread:
http://forums.oracle.com/forums/thread.jspa?messageID=1273670

(N.B. This thread is about the thick driver but I ran into the same
problem using the thin driver!)

Apparently the method JGeometry.store(JGeometry, Connection) (used to
convert JGeometry to STRUCT) has a very nasty shortcoming. When once
called for a particular connection is fails on every later call with
another connection. According to the forum thread mentioned above the
JGeometry.store method caches database descriptors for later use
(probably for performance reasons). I managed to workaround this problem
by resetting the the (static) attribute that contains this cache using
reflections api. (see attached patch).

Did someone ever encounter this problem before? Is there a _real_
solution to this problem? The workaround I'm currently using feels very
'hackish'.

Regards,

Reijer Copier

Index: C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java
===================================================================
--- C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (revision 19856)
+++ C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (working copy)
@@ -38,6 +38,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Field;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -219,7 +220,14 @@
         LOG.logDebug( "Converting JGeometry to STRUCT." );
         STRUCT struct = null;
         try {
-            struct = JGeometry.store( jGeometry, conn );
+         synchronized( JGeometry.class ) {
+         try {
+ Field geomDesc = JGeometry.class.getDeclaredField( "geomDesc" );
+ geomDesc.setAccessible( true );
+ geomDesc.set( null, null );
+ } catch( Exception e ) { }
+            struct = JGeometry.store( jGeometry, conn );
+         }
         } catch ( SQLException e ) {
             throw new DatastoreException( "Error converting JGeometry to STRUCT: " + e.getMessage(), e );
         }
@@ -407,7 +415,14 @@
                     }
                     parameter = new java.sql.Timestamp( ( (Date) parameter ).getTime() );
                 } else if ( parameter != null && parameter instanceof JGeometry ) {
-                    parameter = JGeometry.store( (JGeometry) parameter, conn );
+                 synchronized ( JGeometry.class ) {
+                 try {
+ Field geomDesc = JGeometry.class.getDeclaredField( "geomDesc" );
+ geomDesc.setAccessible( true );
+ geomDesc.set( null, null );
+ } catch( Exception e ) { }
+                    parameter = JGeometry.store( (JGeometry) parameter, conn );
+                 }
                 } else if ( targetSqlType == Types.INTEGER || targetSqlType == Types.SMALLINT
                             || targetSqlType == Types.TINYINT ) {
                     parameter = Integer.parseInt( parameter.toString() );

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel
Markus Schneider-4

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Reijer,

yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
multiple Oracle connections in a single deegree 2 webapp.

Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
fine at the moment.

Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
base, as it will only introduce different behaviour in the case of multiple Oracle connections?

Best regards,
Markus

Reijer Copier wrote:

> I recently configured a deegree WFS using two different Oracle
> databases. Everything seemed to work as expected. Unfortunately I
> encountered a very strange problem while performing GetFeature requests
> including a BBOX filter. Only the feature types of one of the databases
> where accessible. The other requests resulted in the following
> (confusing) exception:
>
> org.deegree.io.datastore.DatastoreException: SQL error while performing
> query: Cannot construct ARRAY instance, invalid connection
>     at
> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>     at
> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>     at
> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>     at
> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>     at java.lang.Thread.run(Thread.java:595)
> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
> invalid connection
>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>     at
> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>     at
> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>     at
> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>     at
> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>
> On the oracle forums I found this thread:
> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>
> (N.B. This thread is about the thick driver but I ran into the same
> problem using the thin driver!)
>
> Apparently the method JGeometry.store(JGeometry, Connection) (used to
> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
> called for a particular connection is fails on every later call with
> another connection. According to the forum thread mentioned above the
> JGeometry.store method caches database descriptors for later use
> (probably for performance reasons). I managed to workaround this problem
> by resetting the the (static) attribute that contains this cache using
> reflections api. (see attached patch).
>
> Did someone ever encounter this problem before? Is there a _real_
> solution to this problem? The workaround I'm currently using feels very
> 'hackish'.
>
> Regards,
>
> Reijer Copier
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel

--
Markus Schneider

l a t / l o n  GmbH
Aennchenstrasse 19           53177 Bonn, Germany
phone ++49 +228 184960       fax ++49 +228 1849629
http://www.lat-lon.de        http://www.deegree.org



------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel

signature.asc (268 bytes) Download Attachment
Reijer Copier

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Markus,

I've made some changes to the patch (see attachment). In case the bug in
JGeometry.store gets fixed eventually this workaround may still cause
problems. But Oracle doesn't seem to care much about JGeometry, as this
problem has been around for quite a while.

Regards,

Reijer

Markus Schneider wrote:

> Hi Reijer,
>
> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
> multiple Oracle connections in a single deegree 2 webapp.
>
> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
> fine at the moment.
>
> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>
> Best regards,
> Markus
>
> Reijer Copier wrote:
>
>  
>> I recently configured a deegree WFS using two different Oracle
>> databases. Everything seemed to work as expected. Unfortunately I
>> encountered a very strange problem while performing GetFeature requests
>> including a BBOX filter. Only the feature types of one of the databases
>> where accessible. The other requests resulted in the following
>> (confusing) exception:
>>
>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>> query: Cannot construct ARRAY instance, invalid connection
>>     at
>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>     at
>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>     at
>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>     at
>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>     at java.lang.Thread.run(Thread.java:595)
>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>> invalid connection
>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>     at
>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>     at
>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>     at
>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>     at
>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>
>> On the oracle forums I found this thread:
>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>
>> (N.B. This thread is about the thick driver but I ran into the same
>> problem using the thin driver!)
>>
>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>> called for a particular connection is fails on every later call with
>> another connection. According to the forum thread mentioned above the
>> JGeometry.store method caches database descriptors for later use
>> (probably for performance reasons). I managed to workaround this problem
>> by resetting the the (static) attribute that contains this cache using
>> reflections api. (see attached patch).
>>
>> Did someone ever encounter this problem before? Is there a _real_
>> solution to this problem? The workaround I'm currently using feels very
>> 'hackish'.
>>
>> Regards,
>>
>> Reijer Copier
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>> http://p.sf.net/sfu/devconf
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>    
>
>
>  
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>  

Index: C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java
===================================================================
--- C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (revision 19856)
+++ C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (working copy)
@@ -38,6 +38,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Field;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -103,6 +104,8 @@
     private static Map<String, Integer> nativeSrsCodeMap = new HashMap<String, Integer>();
 
     private static final int SRS_UNDEFINED = -1;
+    
+    private static Connection lastStoreConnection = null;
 
     static {
         try {
@@ -219,7 +222,7 @@
         LOG.logDebug( "Converting JGeometry to STRUCT." );
         STRUCT struct = null;
         try {
-            struct = JGeometry.store( jGeometry, conn );
+            struct = storeGeometry( jGeometry, conn );
         } catch ( SQLException e ) {
             throw new DatastoreException( "Error converting JGeometry to STRUCT: " + e.getMessage(), e );
         }
@@ -407,7 +410,7 @@
                     }
                     parameter = new java.sql.Timestamp( ( (Date) parameter ).getTime() );
                 } else if ( parameter != null && parameter instanceof JGeometry ) {
-                    parameter = JGeometry.store( (JGeometry) parameter, conn );
+                    parameter = storeGeometry( (JGeometry) parameter, conn );
                 } else if ( targetSqlType == Types.INTEGER || targetSqlType == Types.SMALLINT
                             || targetSqlType == Types.TINYINT ) {
                     parameter = Integer.parseInt( parameter.toString() );
@@ -580,4 +583,34 @@
             }
         }
     }
+    
+    /**
+     * JGeometry.store isn't working when invoked successively using different connections.
+     * This method contains a workaround (based on undocumented behaviour of the Oracle driver) to solve this problem.
+     * @param geometry
+     * geometry to be stored
+     * @param connection
+     * jdbc connection
+     * @return a {@link STRUCT} to be used as query parameter
+     * @throws SQLException
+     */
+    private synchronized static STRUCT storeGeometry( JGeometry geometry, Connection connection )
+     throws SQLException {    
+
+     if( lastStoreConnection != connection ) {
+     LOG.logDebug( "JGeometry.store workaround (lastStoreConnection != connection)" );
+    
+     try {
+     Field geomDesc = JGeometry.class.getDeclaredField( "geomDesc" );
+     geomDesc.setAccessible( true );
+     //geomDesc.set( null, null );
+     } catch( Exception e ) {
+     LOG.logWarning( "JGeometry.store workaround isn't working!", e );
+     }
+    
+     lastStoreConnection = connection;
+     }
+        
+     return JGeometry.store( geometry, connection );
+    }
 }

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel
Markus Schneider-4

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Reijer,

it's applied in trunk, revision 20022.

Thanks,
Markus

Reijer Copier wrote:

> Hi Markus,
>
> I've made some changes to the patch (see attachment). In case the bug in
> JGeometry.store gets fixed eventually this workaround may still cause
> problems. But Oracle doesn't seem to care much about JGeometry, as this
> problem has been around for quite a while.
>
> Regards,
>
> Reijer
>
> Markus Schneider wrote:
>> Hi Reijer,
>>
>> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
>> multiple Oracle connections in a single deegree 2 webapp.
>>
>> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
>> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
>> fine at the moment.
>>
>> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
>> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
>> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>>
>> Best regards,
>> Markus
>>
>> Reijer Copier wrote:
>>
>>  
>>> I recently configured a deegree WFS using two different Oracle
>>> databases. Everything seemed to work as expected. Unfortunately I
>>> encountered a very strange problem while performing GetFeature requests
>>> including a BBOX filter. Only the feature types of one of the databases
>>> where accessible. The other requests resulted in the following
>>> (confusing) exception:
>>>
>>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>>> query: Cannot construct ARRAY instance, invalid connection
>>>     at
>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>>     at
>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>>     at
>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>>     at
>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>     at java.lang.Thread.run(Thread.java:595)
>>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>>> invalid connection
>>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>>     at
>>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>>     at
>>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>>     at
>>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>>     at
>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>>
>>> On the oracle forums I found this thread:
>>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>>
>>> (N.B. This thread is about the thick driver but I ran into the same
>>> problem using the thin driver!)
>>>
>>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>>> called for a particular connection is fails on every later call with
>>> another connection. According to the forum thread mentioned above the
>>> JGeometry.store method caches database descriptors for later use
>>> (probably for performance reasons). I managed to workaround this problem
>>> by resetting the the (static) attribute that contains this cache using
>>> reflections api. (see attached patch).
>>>
>>> Did someone ever encounter this problem before? Is there a _real_
>>> solution to this problem? The workaround I'm currently using feels very
>>> 'hackish'.
>>>
>>> Regards,
>>>
>>> Reijer Copier
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>> http://p.sf.net/sfu/devconf
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> deegree-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>    
>>
>>  
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>> http://p.sf.net/sfu/devconf
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>  
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel

--
Markus Schneider

l a t / l o n  GmbH
Aennchenstrasse 19           53177 Bonn, Germany
phone ++49 +228 184960       fax ++49 +228 1849629
http://www.lat-lon.de        http://www.deegree.org



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel

signature.asc (268 bytes) Download Attachment
Reijer Copier

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Markus,

Thank you for applying the patch! Unfortunately there is still a small
problem. The workaround is executed the very first time the
storeGeometryWithMultiConnHack method is invoked. In theory this could
introduce a regression in the future. I suggest the attached patch to
solve this problem.

Reijer

Markus Schneider wrote:

> Hi Reijer,
>
> it's applied in trunk, revision 20022.
>
> Thanks,
> Markus
>
> Reijer Copier wrote:
>  
>> Hi Markus,
>>
>> I've made some changes to the patch (see attachment). In case the bug in
>> JGeometry.store gets fixed eventually this workaround may still cause
>> problems. But Oracle doesn't seem to care much about JGeometry, as this
>> problem has been around for quite a while.
>>
>> Regards,
>>
>> Reijer
>>
>> Markus Schneider wrote:
>>    
>>> Hi Reijer,
>>>
>>> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
>>> multiple Oracle connections in a single deegree 2 webapp.
>>>
>>> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
>>> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
>>> fine at the moment.
>>>
>>> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
>>> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
>>> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>>>
>>> Best regards,
>>> Markus
>>>
>>> Reijer Copier wrote:
>>>
>>>  
>>>      
>>>> I recently configured a deegree WFS using two different Oracle
>>>> databases. Everything seemed to work as expected. Unfortunately I
>>>> encountered a very strange problem while performing GetFeature requests
>>>> including a BBOX filter. Only the feature types of one of the databases
>>>> where accessible. The other requests resulted in the following
>>>> (confusing) exception:
>>>>
>>>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>>>> query: Cannot construct ARRAY instance, invalid connection
>>>>     at
>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>>>     at
>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>>>     at
>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>>>     at
>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>>>     at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>>     at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>>     at java.lang.Thread.run(Thread.java:595)
>>>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>>>> invalid connection
>>>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>>>     at
>>>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>>>     at
>>>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>>>     at
>>>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>>>     at
>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>>>
>>>> On the oracle forums I found this thread:
>>>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>>>
>>>> (N.B. This thread is about the thick driver but I ran into the same
>>>> problem using the thin driver!)
>>>>
>>>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>>>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>>>> called for a particular connection is fails on every later call with
>>>> another connection. According to the forum thread mentioned above the
>>>> JGeometry.store method caches database descriptors for later use
>>>> (probably for performance reasons). I managed to workaround this problem
>>>> by resetting the the (static) attribute that contains this cache using
>>>> reflections api. (see attached patch).
>>>>
>>>> Did someone ever encounter this problem before? Is there a _real_
>>>> solution to this problem? The workaround I'm currently using feels very
>>>> 'hackish'.
>>>>
>>>> Regards,
>>>>
>>>> Reijer Copier
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconf
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> deegree-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>    
>>>>        
>>>  
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>> http://p.sf.net/sfu/devconf
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> deegree-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>  
>>>      
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>> http://p.sf.net/sfu/devconf
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>    
>
>
>  
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>  

Index: C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java
===================================================================
--- C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (revision 20029)
+++ C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (working copy)
@@ -107,7 +107,7 @@
 
     // used for identifying the last active connection (if changed, Reijer's JGeometry store workaround patch is
     // applied)
-    private static Connection lastStoreConnection;
+    private static Connection lastStoreConnection = null;
 
     static {
         try {
@@ -244,7 +244,7 @@
      */
     private synchronized STRUCT storeGeometryWithMultiConnHack( JGeometry geometry, Connection connection )
                             throws SQLException {
-        if ( lastStoreConnection != connection ) {
+        if ( lastStoreConnection != connection && lastStoreConnection != null ) {
             LOG.logDebug( "JGeometry#store(...) workaround (lastStoreConnection != connection)" );
             try {
                 Field geomDesc = JGeometry.class.getDeclaredField( "geomDesc" );
@@ -252,8 +252,10 @@
             } catch ( Exception e ) {
                 LOG.logWarning( "Exception caught applying JGeometry.store workaround: " + e.getMessage(), e );
             }
-            lastStoreConnection = connection;
         }
+        
+        lastStoreConnection = connection;
+        
         return JGeometry.store( geometry, connection );
     }
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel
Markus Schneider-4

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Applied in revision 20030.

Reijer Copier wrote:

> Hi Markus,
>
> Thank you for applying the patch! Unfortunately there is still a small
> problem. The workaround is executed the very first time the
> storeGeometryWithMultiConnHack method is invoked. In theory this could
> introduce a regression in the future. I suggest the attached patch to
> solve this problem.
>
> Reijer
>
> Markus Schneider wrote:
>> Hi Reijer,
>>
>> it's applied in trunk, revision 20022.
>>
>> Thanks,
>> Markus
>>
>> Reijer Copier wrote:
>>  
>>> Hi Markus,
>>>
>>> I've made some changes to the patch (see attachment). In case the bug in
>>> JGeometry.store gets fixed eventually this workaround may still cause
>>> problems. But Oracle doesn't seem to care much about JGeometry, as this
>>> problem has been around for quite a while.
>>>
>>> Regards,
>>>
>>> Reijer
>>>
>>> Markus Schneider wrote:
>>>    
>>>> Hi Reijer,
>>>>
>>>> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
>>>> multiple Oracle connections in a single deegree 2 webapp.
>>>>
>>>> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
>>>> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
>>>> fine at the moment.
>>>>
>>>> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
>>>> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
>>>> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>>>>
>>>> Best regards,
>>>> Markus
>>>>
>>>> Reijer Copier wrote:
>>>>
>>>>  
>>>>      
>>>>> I recently configured a deegree WFS using two different Oracle
>>>>> databases. Everything seemed to work as expected. Unfortunately I
>>>>> encountered a very strange problem while performing GetFeature requests
>>>>> including a BBOX filter. Only the feature types of one of the databases
>>>>> where accessible. The other requests resulted in the following
>>>>> (confusing) exception:
>>>>>
>>>>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>>>>> query: Cannot construct ARRAY instance, invalid connection
>>>>>     at
>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>>>>     at
>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>>>>     at
>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>>>>     at
>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>>>>     at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>>>     at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>>>     at java.lang.Thread.run(Thread.java:595)
>>>>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>>>>> invalid connection
>>>>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>>>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>>>>     at
>>>>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>>>>     at
>>>>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>>>>     at
>>>>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>>>>     at
>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>>>>
>>>>> On the oracle forums I found this thread:
>>>>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>>>>
>>>>> (N.B. This thread is about the thick driver but I ran into the same
>>>>> problem using the thin driver!)
>>>>>
>>>>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>>>>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>>>>> called for a particular connection is fails on every later call with
>>>>> another connection. According to the forum thread mentioned above the
>>>>> JGeometry.store method caches database descriptors for later use
>>>>> (probably for performance reasons). I managed to workaround this problem
>>>>> by resetting the the (static) attribute that contains this cache using
>>>>> reflections api. (see attached patch).
>>>>>
>>>>> Did someone ever encounter this problem before? Is there a _real_
>>>>> solution to this problem? The workaround I'm currently using feels very
>>>>> 'hackish'.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Reijer Copier
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>> http://p.sf.net/sfu/devconf
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> deegree-devel mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>    
>>>>>        
>>>>  
>>>> ------------------------------------------------------------------------
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconf
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> deegree-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>  
>>>>      
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>> http://p.sf.net/sfu/devconf
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> deegree-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>    
>>
>>  
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>  
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel

--
Markus Schneider

l a t / l o n  GmbH
Aennchenstrasse 19           53177 Bonn, Germany
phone ++49 +228 184960       fax ++49 +228 1849629
http://www.lat-lon.de        http://www.deegree.org



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel

signature.asc (268 bytes) Download Attachment
Reijer Copier

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Markus,

Today I discovered that the line that performs the actual trick is not
included in the version currently in the trunk (rev. 20030). Could you
apply the attached patch?

Reijer

Markus Schneider wrote:

> Applied in revision 20030.
>
> Reijer Copier wrote:
>  
>> Hi Markus,
>>
>> Thank you for applying the patch! Unfortunately there is still a small
>> problem. The workaround is executed the very first time the
>> storeGeometryWithMultiConnHack method is invoked. In theory this could
>> introduce a regression in the future. I suggest the attached patch to
>> solve this problem.
>>
>> Reijer
>>
>> Markus Schneider wrote:
>>    
>>> Hi Reijer,
>>>
>>> it's applied in trunk, revision 20022.
>>>
>>> Thanks,
>>> Markus
>>>
>>> Reijer Copier wrote:
>>>  
>>>      
>>>> Hi Markus,
>>>>
>>>> I've made some changes to the patch (see attachment). In case the bug in
>>>> JGeometry.store gets fixed eventually this workaround may still cause
>>>> problems. But Oracle doesn't seem to care much about JGeometry, as this
>>>> problem has been around for quite a while.
>>>>
>>>> Regards,
>>>>
>>>> Reijer
>>>>
>>>> Markus Schneider wrote:
>>>>    
>>>>        
>>>>> Hi Reijer,
>>>>>
>>>>> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
>>>>> multiple Oracle connections in a single deegree 2 webapp.
>>>>>
>>>>> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
>>>>> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
>>>>> fine at the moment.
>>>>>
>>>>> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
>>>>> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
>>>>> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>>>>>
>>>>> Best regards,
>>>>> Markus
>>>>>
>>>>> Reijer Copier wrote:
>>>>>
>>>>>  
>>>>>      
>>>>>          
>>>>>> I recently configured a deegree WFS using two different Oracle
>>>>>> databases. Everything seemed to work as expected. Unfortunately I
>>>>>> encountered a very strange problem while performing GetFeature requests
>>>>>> including a BBOX filter. Only the feature types of one of the databases
>>>>>> where accessible. The other requests resulted in the following
>>>>>> (confusing) exception:
>>>>>>
>>>>>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>>>>>> query: Cannot construct ARRAY instance, invalid connection
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>>>>>     at
>>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>>>>>     at
>>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>>>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>>>>>     at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>>>>     at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>>>>     at java.lang.Thread.run(Thread.java:595)
>>>>>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>>>>>> invalid connection
>>>>>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>>>>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>>>>>     at
>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>>>>>
>>>>>> On the oracle forums I found this thread:
>>>>>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>>>>>
>>>>>> (N.B. This thread is about the thick driver but I ran into the same
>>>>>> problem using the thin driver!)
>>>>>>
>>>>>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>>>>>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>>>>>> called for a particular connection is fails on every later call with
>>>>>> another connection. According to the forum thread mentioned above the
>>>>>> JGeometry.store method caches database descriptors for later use
>>>>>> (probably for performance reasons). I managed to workaround this problem
>>>>>> by resetting the the (static) attribute that contains this cache using
>>>>>> reflections api. (see attached patch).
>>>>>>
>>>>>> Did someone ever encounter this problem before? Is there a _real_
>>>>>> solution to this problem? The workaround I'm currently using feels very
>>>>>> 'hackish'.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Reijer Copier
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>>> http://p.sf.net/sfu/devconf
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> deegree-devel mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>>    
>>>>>>        
>>>>>>            
>>>>>  
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>> http://p.sf.net/sfu/devconf
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> deegree-devel mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>  
>>>>>      
>>>>>          
>>>> ------------------------------------------------------------------------
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconf
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> deegree-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>    
>>>>        
>>>  
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> deegree-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>  
>>>      
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>    
>
>
>  
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>  

Index: C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java
===================================================================
--- C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (revision 20083)
+++ C:/Users/copierrj/geoide-workspace/deegree/src/org/deegree/io/datastore/sql/oracle/OracleDatastore.java (working copy)
@@ -253,6 +253,7 @@
             try {
                 Field geomDesc = JGeometry.class.getDeclaredField( "geomDesc" );
                 geomDesc.setAccessible( true );
+                geomDesc.set( null, null );
             } catch ( Exception e ) {
                 LOG.logWarning( "Exception caught applying JGeometr#store(...) workaround: " + e.getMessage(), e );
             }

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel
Markus Schneider-4

Re: [OracleDatastore] JGeometry.store issue

Reply Threaded More More options
Print post
Permalink
Hi Reijer,

sorry for this. Fixed in SVN revision 20611.

Best regards,
Markus

Reijer Copier wrote:

> Hi Markus,
>
> Today I discovered that the line that performs the actual trick is not
> included in the version currently in the trunk (rev. 20030). Could you
> apply the attached patch?
>
> Reijer
>
> Markus Schneider wrote:
>> Applied in revision 20030.
>>
>> Reijer Copier wrote:
>>  
>>> Hi Markus,
>>>
>>> Thank you for applying the patch! Unfortunately there is still a small
>>> problem. The workaround is executed the very first time the
>>> storeGeometryWithMultiConnHack method is invoked. In theory this could
>>> introduce a regression in the future. I suggest the attached patch to
>>> solve this problem.
>>>
>>> Reijer
>>>
>>> Markus Schneider wrote:
>>>    
>>>> Hi Reijer,
>>>>
>>>> it's applied in trunk, revision 20022.
>>>>
>>>> Thanks,
>>>> Markus
>>>>
>>>> Reijer Copier wrote:
>>>>  
>>>>      
>>>>> Hi Markus,
>>>>>
>>>>> I've made some changes to the patch (see attachment). In case the bug in
>>>>> JGeometry.store gets fixed eventually this workaround may still cause
>>>>> problems. But Oracle doesn't seem to care much about JGeometry, as this
>>>>> problem has been around for quite a while.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Reijer
>>>>>
>>>>> Markus Schneider wrote:
>>>>>    
>>>>>        
>>>>>> Hi Reijer,
>>>>>>
>>>>>> yes, I know this one. It's nasty and we don't have a good solution -- for our projects we actually refrained from using
>>>>>> multiple Oracle connections in a single deegree 2 webapp.
>>>>>>
>>>>>> Thanks for the patch. However, as it is a hack based on undocumented behaviour of the Oracle driver, I am a bit
>>>>>> hesistant to accept it for trunk. I can imagine that it may introduce regressions for single Oracle use-cases that work
>>>>>> fine at the moment.
>>>>>>
>>>>>> Maybe you can improve it in such a way that the database descriptor is only deleted when necessary (i.e. when it changed
>>>>>> compared to the previous usage)? This would guarantee that we don't have any drawbacks compared to the current code
>>>>>> base, as it will only introduce different behaviour in the case of multiple Oracle connections?
>>>>>>
>>>>>> Best regards,
>>>>>> Markus
>>>>>>
>>>>>> Reijer Copier wrote:
>>>>>>
>>>>>>  
>>>>>>      
>>>>>>          
>>>>>>> I recently configured a deegree WFS using two different Oracle
>>>>>>> databases. Everything seemed to work as expected. Unfortunately I
>>>>>>> encountered a very strange problem while performing GetFeature requests
>>>>>>> including a BBOX filter. Only the feature types of one of the databases
>>>>>>> where accessible. The other requests resulted in the following
>>>>>>> (confusing) exception:
>>>>>>>
>>>>>>> org.deegree.io.datastore.DatastoreException: SQL error while performing
>>>>>>> query: Cannot construct ARRAY instance, invalid connection
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:196)
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:155)
>>>>>>>     at
>>>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:368)
>>>>>>>     at
>>>>>>> org.deegree.ogcwebservices.wfs.GetFeatureHandler$QueryTask.call(GetFeatureHandler.java:346)
>>>>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>>>>>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>>>>>>>     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>>>>>     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>>>>>     at java.lang.Thread.run(Thread.java:595)
>>>>>>> Caused by: java.sql.SQLException: Cannot construct ARRAY instance,
>>>>>>> invalid connection
>>>>>>>     at oracle.sql.ARRAY.<init>(ARRAY.java:123)
>>>>>>>     at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1289)
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.oracle.OracleDatastore.prepareStatement(OracleDatastore.java:434)
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.QueryHandler.performResultsQuery(QueryHandler.java:181)
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.QueryHandler.performQuery(QueryHandler.java:143)
>>>>>>>     at
>>>>>>> org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(AbstractSQLDatastore.java:192)
>>>>>>>
>>>>>>> On the oracle forums I found this thread:
>>>>>>> http://forums.oracle.com/forums/thread.jspa?messageID=1273670
>>>>>>>
>>>>>>> (N.B. This thread is about the thick driver but I ran into the same
>>>>>>> problem using the thin driver!)
>>>>>>>
>>>>>>> Apparently the method JGeometry.store(JGeometry, Connection) (used to
>>>>>>> convert JGeometry to STRUCT) has a very nasty shortcoming. When once
>>>>>>> called for a particular connection is fails on every later call with
>>>>>>> another connection. According to the forum thread mentioned above the
>>>>>>> JGeometry.store method caches database descriptors for later use
>>>>>>> (probably for performance reasons). I managed to workaround this problem
>>>>>>> by resetting the the (static) attribute that contains this cache using
>>>>>>> reflections api. (see attached patch).
>>>>>>>
>>>>>>> Did someone ever encounter this problem before? Is there a _real_
>>>>>>> solution to this problem? The workaround I'm currently using feels very
>>>>>>> 'hackish'.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Reijer Copier
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>>>> http://p.sf.net/sfu/devconf
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> deegree-devel mailing list
>>>>>>> [hidden email]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>>>    
>>>>>>>        
>>>>>>>            
>>>>>>  
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>>> http://p.sf.net/sfu/devconf
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> deegree-devel mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>>  
>>>>>>      
>>>>>>          
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>>>> http://p.sf.net/sfu/devconf
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> deegree-devel mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>>    
>>>>>        
>>>>  
>>>> ------------------------------------------------------------------------
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconference
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> deegree-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>>  
>>>>      
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> deegree-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>>    
>>
>>  
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> deegree-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/deegree-devel
>>  
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> deegree-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/deegree-devel

--
Markus Schneider

l a t / l o n  GmbH
Aennchenstrasse 19           53177 Bonn, Germany
phone ++49 +228 184960       fax ++49 +228 1849629
http://www.lat-lon.de        http://www.deegree.org



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
deegree-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/deegree-devel

signature.asc (268 bytes) Download Attachment