Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone knows the the cause and how to resolve the "Could not obtain native oracle connection" error?

I'm using GeoTools 2.7.4, a oracle 11g DB, ojdbc14.jar, and a simple java code on a Tomcat 6 like this:

Map map = new HashMap();
map.put( "dbtype", "oracle");
map.put( "jndiReferenceName", "java:comp/env/jdbc/GisDS");

OracleNGJNDIDataStoreFactory factory = new OracleNGJNDIDataStoreFactory();"Can process? "+ factory.canProcess(map));
store = factory.createDataStore(map);

SimpleFeatureSource featureSource = store.getFeatureSource(viewName);;

And my context.xml:

<Resource name="jdbc/GisDS" auth="Container" type="javax.sql.DataSource" 
    username="***" password="***"
    maxActive="25" maxIdle="8" maxWait="10000" 
    removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" 
    poolPreparedStatements="true" maxOpenPreparedStatements="100"
    validationQuery="SELECT SYSDATE FROM DUAL"/>

And I always get the "Could not obtain native oracle connection" error:

java.lang.RuntimeException: Error occured calculating bounds
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(
        at org.geotools.jdbc.JDBCFeatureStore.getBoundsInternal(
        at ***.GisServlet.doGet(
        at javax.servlet.http.HttpServlet.service(
        at javax.servlet.http.HttpServlet.service(
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
        at org.apache.catalina.core.StandardWrapperValve.invoke(
        at org.apache.catalina.core.StandardContextValve.invoke(
        at org.apache.catalina.core.StandardHostValve.invoke(
        at org.apache.catalina.valves.ErrorReportValve.invoke(
        at org.apache.catalina.core.StandardEngineValve.invoke(
        at org.apache.catalina.connector.CoyoteAdapter.service(
        at org.apache.coyote.http11.Http11Processor.process(
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: Error occured calculating bounds
        at org.geotools.jdbc.JDBCDataStore.getBounds(
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(
        ... 19 more
Caused by: java.sql.SQLException: Could not obtain native oracle connection for class org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
        at org.geotools.jdbc.JDBCDataStore.getBounds(
        ... 20 more

I've tried to connect to a 10g DB, I've tried using the ojdbc6, and I always end with the same result.

The strange is, If I replace the getBounds() with size() it works.

share|improve this question

closed as off topic by iant May 16 '13 at 13:52

Questions on Geographic Information Systems Stack Exchange are expected to relate to geographic information systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question. has some real Oracle boffins on it, you may wish to ask there. They're no Geo types but they know lots about Oracle. – GIS-Jonathan Apr 16 '12 at 11:37
@GIS-Jonathan Thanks for the suggestion. At stackoverflow:… – Jose Antonio Apr 16 '12 at 13:23