org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor

Spring JIRA | Davor Cengija | 1 decade ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Hi, we are developing application on Websphere 6 with Oracle 9i database. Some LOBs are saved to database using Hibernate 3. We are using Websphere datasource so we need to use WebSphereNativeJdbcExtractor which causes us problems. Our configuration: <!-- Lob handler for Oracle 9i and IBM Websphere data source --> <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor"> <bean class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/> </property> </bean> <!-- Hibernate session factory definition --> <bean id="auditSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="lobHandler" ref="lobHandler"/> ... When LOB object is about to be saved exception is thrown: org.springframework.dao.DataAccessResourceFailureException: Could not create Oracle LOB; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection(OracleLobHandler.java:360) at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:328) return in code below from WebSphereNativeJdbcExtractor returned connection is type of oracle.jdbc.driver.OracleConnection instead of oracle.jdbc.OracleConnection /** * Retrieve the Connection via WebSphere's <code>getNativeConnection</code> method. */ protected Connection doGetNativeConnection(Connection con) throws SQLException { // WebSphere 5 connection? if (this.webSphere5ConnectionClass != null && this.webSphere5ConnectionClass.isAssignableFrom(con.getClass())) { try { // WebSphere 5's WSJdbcUtil.getNativeConnection(wsJdbcConnection) return (Connection) this.webSphere5NativeConnectionMethod.invoke(null, new Object[] {con}); } So in org.springframework.jdbc.support.lob.OracleLobHandler in getOracleConnection() conToUse is type of oracle.jdbc.driver.OracleConnection (implements java.sql.Connection) and connectionClass is oracle.jdbc.OracleConnection type. Because of that, exception is throwned (as specified in getOracleConnection()). We are using ojdbc14.jar for database connection. We hope that you will do some testing on Websphere 6 to resolve this problem.

    Spring JIRA | 1 decade ago | Davor Cengija
    org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor
  2. 0

    Hi, we are developing application on Websphere 6 with Oracle 9i database. Some LOBs are saved to database using Hibernate 3. We are using Websphere datasource so we need to use WebSphereNativeJdbcExtractor which causes us problems. Our configuration: <!-- Lob handler for Oracle 9i and IBM Websphere data source --> <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor"> <bean class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/> </property> </bean> <!-- Hibernate session factory definition --> <bean id="auditSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="lobHandler" ref="lobHandler"/> ... When LOB object is about to be saved exception is thrown: org.springframework.dao.DataAccessResourceFailureException: Could not create Oracle LOB; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection(OracleLobHandler.java:360) at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:328) return in code below from WebSphereNativeJdbcExtractor returned connection is type of oracle.jdbc.driver.OracleConnection instead of oracle.jdbc.OracleConnection /** * Retrieve the Connection via WebSphere's <code>getNativeConnection</code> method. */ protected Connection doGetNativeConnection(Connection con) throws SQLException { // WebSphere 5 connection? if (this.webSphere5ConnectionClass != null && this.webSphere5ConnectionClass.isAssignableFrom(con.getClass())) { try { // WebSphere 5's WSJdbcUtil.getNativeConnection(wsJdbcConnection) return (Connection) this.webSphere5NativeConnectionMethod.invoke(null, new Object[] {con}); } So in org.springframework.jdbc.support.lob.OracleLobHandler in getOracleConnection() conToUse is type of oracle.jdbc.driver.OracleConnection (implements java.sql.Connection) and connectionClass is oracle.jdbc.OracleConnection type. Because of that, exception is throwned (as specified in getOracleConnection()). We are using ojdbc14.jar for database connection. We hope that you will do some testing on Websphere 6 to resolve this problem.

    Spring JIRA | 1 decade ago | Davor Cengija
    org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor
  3. 0

    [SPR-1317] OracleLobHandler + WebSphereNativeJdbcExtractor doesn't work on Websphere 6 - Spring JIRA

    spring.io | 1 year ago
    org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on , not on - specify a corresponding NativeJdbcExtractor
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Tomcat - User - tomcat and DB oracle problem - only in higher versions

    nabble.com | 1 year ago
    org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [org.apache.tomcat.dbcp.dbcp.PoolableConnection]: specify a corresponding NativeJdbcExtractor; nested exception is java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolableConnection cannot be cast to oracle.jdbc.OracleConnection
  6. 0

    [Tomcat-users] tomcat and DB oracle problem - only in higher versions - Grokbase

    grokbase.com | 1 year ago
    org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [org.apache.tomcat.dbcp.dbcp.PoolableConnection]: specify a corresponding NativeJdbcExtractor; nested exception is java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolableConnection cannot be cast to oracle.jdbc.OracleConnection

    Root Cause Analysis

    1. org.springframework.dao.InvalidDataAccessApiUsageException

      OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor

      at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection()
    2. Spring Framework
      OracleLobHandler$OracleLobCreator.createLob
      1. org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection(OracleLobHandler.java:360)
      2. org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:328)
      2 frames