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
  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 | 11 months 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

    When accessing clob data using 10g driver, OracleLobHandler fails because the new driver is returning oracle.jdbc.driver.T4CConnection instead of oracle.jdbc.OracleConnection. according to atlassian folks, this is supposed to be reverted back in the newer version of 10g driver, but i still getting the exception with the version suggested by atlassian. http://confluence.atlassian.com/display/DOC/Deploy+against+an+Oracle+database Stacktrace below: INFO: 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.T4CConnection] - specify a corresponding NativeJdbcExtractor 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.T4CConnection] - specify a corresponding NativeJdbcExtractor org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.T4CConnection] - 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) at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.setClobAsString(OracleLobHandler.java:259) at org.springframework.orm.hibernate.support.ClobStringType.nullSafeSetInternal(ClobStringType.java:80) at org.springframework.orm.hibernate.support.AbstractLobType.nullSafeSet(AbstractLobType.java:159) at net.sf.hibernate.type.CustomType.nullSafeSet(CustomType.java:118) at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:387) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:460) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436) at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261) at com.vivakos.kx.persistence.hibernate.AbstractDAO.persist(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122) at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:164) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174) at $Proxy26.persist(Unknown Source) at com.vivakos.kx.persistence.service.TxContentServiceImpl.persistFolder(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324)

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

    When accessing clob data using 10g driver, OracleLobHandler fails because the new driver is returning oracle.jdbc.driver.T4CConnection instead of oracle.jdbc.OracleConnection. according to atlassian folks, this is supposed to be reverted back in the newer version of 10g driver, but i still getting the exception with the version suggested by atlassian. http://confluence.atlassian.com/display/DOC/Deploy+against+an+Oracle+database Stacktrace below: INFO: 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.T4CConnection] - specify a corresponding NativeJdbcExtractor 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.T4CConnection] - specify a corresponding NativeJdbcExtractor org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.T4CConnection] - 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) at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.setClobAsString(OracleLobHandler.java:259) at org.springframework.orm.hibernate.support.ClobStringType.nullSafeSetInternal(ClobStringType.java:80) at org.springframework.orm.hibernate.support.AbstractLobType.nullSafeSet(AbstractLobType.java:159) at net.sf.hibernate.type.CustomType.nullSafeSet(CustomType.java:118) at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:387) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:460) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436) at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261) at com.vivakos.kx.persistence.hibernate.AbstractDAO.persist(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122) at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:164) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174) at $Proxy26.persist(Unknown Source) at com.vivakos.kx.persistence.service.TxContentServiceImpl.persistFolder(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324)

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

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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