Solr
  1. Solr
  2. SOLR-1794

Dataimport of CLOB fields fails when getCharacterStream() is defined in a superclass

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 3.1, 4.0-ALPHA
    • Labels:
      None
    • Environment:

      Oracle WebLogic 10.3.2

      Description

      When running Solr on WebLogic application server 10.3.2, the dataimport for CLOB fields are failing. Line 109 in FieldReaderDataSource.java illustrates the problem:

      Method m = clob.getClass().getDeclaredMethod("getCharacterStream");

      Since getDeclaredMethod instead of getMethod is used, the getCharacterStream() method will not be found if it is defined in a superclass of clob. This is exactly what
      happens in e.g. WebLogic 10.3.2, since the object returned is a dynamically created wrapper class called Clob_oracle_sql_CLOB. This class does not define
      getCharacterStream(), but it inherits from another class that does. This problem will also occur in other places where getDeclaredMethod used in conjunction with the CLOB
      or BLOB datatypes.

      Stacktrace:

      org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to get reader from clob Processing Document # 1
      at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
      at org.apache.solr.handler.dataimport.FieldReaderDataSource.readCharStream(FieldReaderDataSource.java:118)
      at org.apache.solr.handler.dataimport.ClobTransformer.readFromClob(ClobTransformer.java:69)
      at org.apache.solr.handler.dataimport.ClobTransformer.transformRow(ClobTransformer.java:61)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.applyTransformer(EntityProcessorWrapper.java:195)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:241)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:357)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:383)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:242)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:180)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:331)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:389)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:370)
      Caused by: java.lang.NoSuchMethodException: weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB.getCharacterStream()
      at java.lang.Class.getDeclaredMethod(Class.java:1937)
      at org.apache.solr.handler.dataimport.FieldReaderDataSource.readCharStream(FieldReaderDataSource.java:109)
      ... 11 more

      1. ASF.LICENSE.NOT.GRANTED--FieldReaderDataSource.java
        5 kB
        Stein Kåre Skytteren
      2. SOLR-1794.patch
        2 kB
        Robert Muir

        Activity

        Hide
        Grant Ingersoll added a comment -

        Bulk close for 3.1.0 release

        Show
        Grant Ingersoll added a comment - Bulk close for 3.1.0 release
        Hide
        Robert Muir added a comment -

        Committed revision 1024256, 1024258 (3x).

        Thanks Gunnar!

        Show
        Robert Muir added a comment - Committed revision 1024256, 1024258 (3x). Thanks Gunnar!
        Hide
        Robert Muir added a comment -

        Thanks for the review Uwe.

        I will commit the bugfix shortly unless there are objections.

        Show
        Robert Muir added a comment - Thanks for the review Uwe. I will commit the bugfix shortly unless there are objections.
        Hide
        Uwe Schindler added a comment -

        The method is defined as public in the JDBC API since at least Java 1.4, so why use reflection at all? I would simply remove the reflection as Robert did and resolve that issue.

        Show
        Uwe Schindler added a comment - The method is defined as public in the JDBC API since at least Java 1.4, so why use reflection at all? I would simply remove the reflection as Robert did and resolve that issue.
        Hide
        Robert Muir added a comment -

        I don't understand why reflection is being used here at all.

        getCharacterStream and getBinaryStream are both defined as public methods in the java.sql.Clob/Blob interfaces since java 1.4, so all the reflection and comments like:

        //Most of the JDBC drivers have getBinaryStream defined as public
        

        make no sense to me... of course its public, it must be !

        all tests patch with the reflection removed.

        Show
        Robert Muir added a comment - I don't understand why reflection is being used here at all. getCharacterStream and getBinaryStream are both defined as public methods in the java.sql.Clob/Blob interfaces since java 1.4, so all the reflection and comments like: //Most of the JDBC drivers have getBinaryStream defined as public make no sense to me... of course its public, it must be ! all tests patch with the reflection removed.
        Hide
        Stein Kåre Skytteren added a comment - - edited

        A fixed version of org.apache.solr.handler.dataimport.FieldReaderDataSource
        Change line 89 and 110 to use getMethod instead of getDeclaredMethod.

        This works for us on Weblogic 10.3.2.

        Since I cannot commit to the repository I hope that someone will update the file so we may upgrade without deploying our own version of this class.

        Show
        Stein Kåre Skytteren added a comment - - edited A fixed version of org.apache.solr.handler.dataimport.FieldReaderDataSource Change line 89 and 110 to use getMethod instead of getDeclaredMethod. This works for us on Weblogic 10.3.2. Since I cannot commit to the repository I hope that someone will update the file so we may upgrade without deploying our own version of this class.

          People

          • Assignee:
            Robert Muir
            Reporter:
            Gunnar Gauslaa Bergem
          • Votes:
            9 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development