Spring Framework
  1. Spring Framework
  2. SPR-5538

Improve configurability for OracleLobHandler (be able to set classloader to use)

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Component/s: Data
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      i get a ClassNotFound even if the class is available for the application classloader (this is verified via the websphere admin console (troubleshooting -> class loader viewer - all the ora classes can be loaded just fine).

      org.springframework.dao.DataAccessResourceFailureException: Could not create Oracle LOB; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Couldn't initialize OracleLobHandler b
      ecause Oracle driver classes are not available. Note that OracleLobHandler requires Oracle JDBC driver 9i or higher!; nested exception is java.lang.ClassNotFoundException: oracle.sql.BLOB
      Caused by:
      org.springframework.dao.InvalidDataAccessApiUsageException: Couldn't initialize OracleLobHandler because Oracle driver classes are not available. Note that OracleLobHandler requires Oracle JDBC driver 9i or
      higher!; nested exception is java.lang.ClassNotFoundException: oracle.sql.BLOB
      Caused by:
      java.lang.ClassNotFoundException: oracle.sql.BLOB
      at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
      at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.springframework.jdbc.support.lob.OracleLobHandler.initOracleDriverClasses(OracleLobHandler.java:150)
      at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:339)
      at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.setClobAsCharacterStream(OracleLobHandler.java:311)
      at com.te.pwh.services.history.jobs.HistoricalizationItemWriter$1.setValues(HistoricalizationItemWriter.java:116)
      at org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback.doInPreparedStatement(AbstractLobCreatingPreparedStatementCallback.java:70)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:538)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:566)
      at com.te.pwh.services.history.jobs.HistoricalizationItemWriter.handleTpwPafios(HistoricalizationItemWriter.java:110)
      at com.te.pwh.services.history.jobs.HistoricalizationItemWriter.write(HistoricalizationItemWriter.java:89)
      at org.springframework.batch.item.support.CompositeItemWriter.write(CompositeItemWriter.java:30)
      at org.springframework.batch.item.support.DelegatingItemWriter.write(DelegatingItemWriter.java:45)
      at org.springframework.batch.core.step.item.BatchListenerFactoryHelper$2.write(BatchListenerFactoryHelper.java:99)
      at org.springframework.batch.core.step.item.SimpleItemHandler.doWrite(SimpleItemHandler.java:105)
      at org.springframework.batch.core.step.item.SkipLimitStepFactoryBean$StatefulRetryItemHandler$1.doWithRetry(SkipLimitStepFactoryBean.java:402)
      at org.springframework.batch.retry.callback.RecoveryRetryCallback.doWithRetry(RecoveryRetryCallback.java:109)
      at org.springframework.batch.retry.support.RetryTemplate.execute(RetryTemplate.java:168)
      at org.springframework.batch.core.step.item.SkipLimitStepFactoryBean$StatefulRetryItemHandler.write(SkipLimitStepFactoryBean.java:419)
      at org.springframework.batch.core.step.item.SimpleItemHandler.handle(SimpleItemHandler.java:71)
      at org.springframework.batch.core.step.item.ItemOrientedStep$3.doInIteration(ItemOrientedStep.java:391)
      at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:346)
      at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:212)
      at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
      at org.springframework.batch.core.step.item.ItemOrientedStep.processChunk(ItemOrientedStep.java:382)
      at org.springframework.batch.core.step.item.ItemOrientedStep$2.doInIteration(ItemOrientedStep.java:259)
      at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:346)
      at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:212)
      at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
      at org.springframework.batch.core.step.item.ItemOrientedStep.doExecute(ItemOrientedStep.java:236)
      at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:172)
      at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:103)
      at org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextJobFactory$ContextClosingJob.execute(ClassPathXmlApplicationContextJobFactory.java:107)
      at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86)
      at org.springframework.scheduling.commonj.DelegatingWork.run(DelegatingWork.java:61)
      at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1114)
      at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:195)
      at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:187)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

      I found that the OracleLobHandles code looks like this:
      this.blobClass = con.getClass().getClassLoader().loadClass(BLOB_CLASS_NAME);

      which is proibably the root cause of the problem (although I have not got around to step-debug this in the container yet to look into that classloader). The CL should probably be configurable, and use con.getClass().getClassLoader() if not configured otherwise explicitly.

      Now you probably tell me to use: http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jdbc/support/nativejdbc/WebSphereNativeJdbcExtractor.html
      But this is not recommended by IBM (http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html) and I really don't think it will influence which classloader is in use?

      At any rate we reverted to using the DefaultLobHandler as this should be supported by the 10g drivers when only using CLOBs and no BLOBs.

        Activity

        Hide
        Gary McWilliams added a comment -

        We are seeing the same problem. From our testing, using the Default lob handler is working for us.

        We have seen this:
        1. Under WAS on windows
        2. under Tomcat on AIX

        Although we have not investigated fully, the common denominator for us is the IBM JRE.
        Both of these problems are on-site at production clients, so I doubt we can get them to change to using a Sun JRE for a comparison test.
        We do not get the same problems when running on dev systems here, so the above may be pure co-incidence; use this information as you deem fit!

        Show
        Gary McWilliams added a comment - We are seeing the same problem. From our testing, using the Default lob handler is working for us. We have seen this: 1. Under WAS on windows 2. under Tomcat on AIX Although we have not investigated fully, the common denominator for us is the IBM JRE. Both of these problems are on-site at production clients, so I doubt we can get them to change to using a Sun JRE for a comparison test. We do not get the same problems when running on dev systems here, so the above may be pure co-incidence; use this information as you deem fit!
        Hide
        Gary McWilliams added a comment -

        bugger. Sorry, the above text is NOT for this issue, I've commented the wrong one (don't seem able to delete comments).

        We don't have this problem on tomcat + AIX, we do have it on WAS on Windows.

        Show
        Gary McWilliams added a comment - bugger. Sorry, the above text is NOT for this issue, I've commented the wrong one (don't seem able to delete comments). We don't have this problem on tomcat + AIX, we do have it on WAS on Windows.
        Hide
        Felipe Maschio added a comment -

        I have the same problem in same environment(WAS 6)

        Show
        Felipe Maschio added a comment - I have the same problem in same environment(WAS 6)
        Hide
        Damiano Pezzotti added a comment -

        Same problem on WAS7, Oracle 10.2.0.3.0 JDBC Drivers and Oracle 11g DB.
        Using the DefaultLobHandler solved the problem.

        Show
        Damiano Pezzotti added a comment - Same problem on WAS7, Oracle 10.2.0.3.0 JDBC Drivers and Oracle 11g DB. Using the DefaultLobHandler solved the problem.
        Hide
        Rossen Stoyanchev added a comment -

        This issue has been resolved through a selective bulk update, as part of a larger effort to better manage unresolved issues. To qualify for the update, the issue was either created before Spring 3.0 or affects a version older than Spring 3.0 and is not a bug.

        There is a good chance the request was made obsolete, or at least partly outdated, by changes in later versions of Spring including deprecations. It is also possible it didn't get enough traction or we didn't have enough time to address it. One way or another, we didn't get to it.

        If you believe the issue, or some aspects of it, are still relevant and worth pursuing at present you may re-open this issue or create a new one with a more up-to-date description.

        We thank you for your contributions and encourage you to become familiar with the current process of managing Spring Framework JIRA issues that has been in use for over a year.

        Show
        Rossen Stoyanchev added a comment - This issue has been resolved through a selective bulk update, as part of a larger effort to better manage unresolved issues. To qualify for the update, the issue was either created before Spring 3.0 or affects a version older than Spring 3.0 and is not a bug. There is a good chance the request was made obsolete, or at least partly outdated, by changes in later versions of Spring including deprecations. It is also possible it didn't get enough traction or we didn't have enough time to address it. One way or another, we didn't get to it. If you believe the issue, or some aspects of it, are still relevant and worth pursuing at present you may re-open this issue or create a new one with a more up-to-date description. We thank you for your contributions and encourage you to become familiar with the current process of managing Spring Framework JIRA issues that has been in use for over a year.

          People

          • Assignee:
            Thomas Risberg
            Reporter:
            David J. M. Karlsen
            Last updater:
            Trevor Marshall
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 43 weeks, 4 days ago