Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8876

Morphlines fails with "No command builder registered for ..." when using Java 9 due to morphline "importCommands" config option attempting to resolve classname globs

    Details

      Description

      When running Solr in java9, and using the morphlines contrib(s) users may encounter vague errors such as...

      No command builder registered for COMMAND_NAME
      

      This error comes directly from the morphlines code, and relates to the use of wildcards in the importCommands declaration of of morphlines *.conf files used – for example...

      importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
      

      Using wildcards like * and ** in morphline's importCommands config options do not work in java9 due to changes in the underlying JVM classloader.

      This issue is tracked up stream in: https://github.com/kite-sdk/kite/issues/469


      WORK AROUND

      The workaround is to only use fully qualified command class names in importCommands declaration, one for each distinct command used in that conf file.

      Example:

      # Old config, does not work in java9
      # importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
      
      # replaced with...
      
      # using globs (foo.bar.* or foo.bar.**) will not work in Java9 due to classpath scanning limitations
      # so we enumarate every command (builder) we know this config uses below. (see SOLR-8876)
      importCommands : ["org.kitesdk.morphline.stdlib.LogDebugBuilder",
                        "org.apache.solr.morphlines.solr.SanitizeUnknownSolrFieldsBuilder",
                        "org.apache.solr.morphlines.solr.LoadSolrBuilder"]
      

        Issue Links

          Activity

          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 91424ae9633b2f382799691693dd4ce8ed216cb8 in lucene-solr's branch refs/heads/master from Uwe Schindler
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=91424ae ]

          SOLR-8874, SOLR-8876: Disable more Hadoop tests with Java 9

          Show
          jira-bot ASF subversion and git services added a comment - Commit 91424ae9633b2f382799691693dd4ce8ed216cb8 in lucene-solr's branch refs/heads/master from Uwe Schindler [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=91424ae ] SOLR-8874 , SOLR-8876 : Disable more Hadoop tests with Java 9
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 19b4168b3f6ef7c6614ece040948cab9a05be32b in lucene-solr's branch refs/heads/branch_6x from Uwe Schindler
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=19b4168 ]

          SOLR-8874, SOLR-8876: Disable more Hadoop tests with Java 9

          Show
          jira-bot ASF subversion and git services added a comment - Commit 19b4168b3f6ef7c6614ece040948cab9a05be32b in lucene-solr's branch refs/heads/branch_6x from Uwe Schindler [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=19b4168 ] SOLR-8874 , SOLR-8876 : Disable more Hadoop tests with Java 9
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 2e06790bdcf0b26fcc8ecf518284432153dd6a7c in lucene-solr's branch refs/heads/branch_6_0 from Uwe Schindler
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2e06790 ]

          SOLR-8874, SOLR-8876: Disable more Hadoop tests with Java 9

          Show
          jira-bot ASF subversion and git services added a comment - Commit 2e06790bdcf0b26fcc8ecf518284432153dd6a7c in lucene-solr's branch refs/heads/branch_6_0 from Uwe Schindler [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2e06790 ] SOLR-8874 , SOLR-8876 : Disable more Hadoop tests with Java 9
          Hide
          hossman Hoss Man added a comment -

          Root issue appears to be a (non-test) bug in how morphlines parses it's config file.

          Syntax like this...

              importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
          

          ...is intended to trigger classpath scanning of those package (prefixes) looking for classes that implement morphline's CommandBuilder interface, which can then be refered to by name later in the config.

          This classpath scanning doesn't work in java9 (likely due to the way the ClassLoader specifics have changed)

          It appears that this limitation can be worked arround by having a config which explicitly identifies all of the *Builder classes needed for the config, e.g. ...

              # using globs (foo.bar.* or foo.bar.**) will not work in Java9 due to classpath scanning limitations
              # so we enumarate every command (builder) we know this config uses below. (see SOLR-8876)
              importCommands : ["org.kitesdk.morphline.stdlib.LogDebugBuilder",
                                "org.apache.solr.morphlines.solr.SanitizeUnknownSolrFieldsBuilder",
          		      "org.apache.solr.morphlines.solr.LoadSolrBuilder"]
          

          I opened an upstream issue: https://github.com/kite-sdk/kite/issues/469


          The attached patch removes these problematic globs from all the test configs in solr, and removes all "SOLR-8876" + Constants.JRE_IS_MINIMUM_JAVA9 related "assumes". With this patch, running morphline-core, morphline-cell, & map-reduce tests under java9 seem to pass/skip reliably (and failures found when using -Dtests.awaitsfix=true seem to match the existing test failures using -Dtests.awaitsfix=true with java8)

          I suggest we commit & backport this patch, but leave this jira open with a modified summary/description drawing attention to the morphlines config limitation in java9 and the workaround.

          Show
          hossman Hoss Man added a comment - Root issue appears to be a (non-test) bug in how morphlines parses it's config file. Syntax like this... importCommands : ["org.kitesdk.**", "org.apache.solr.**"] ...is intended to trigger classpath scanning of those package (prefixes) looking for classes that implement morphline's CommandBuilder interface, which can then be refered to by name later in the config. This classpath scanning doesn't work in java9 (likely due to the way the ClassLoader specifics have changed) It appears that this limitation can be worked arround by having a config which explicitly identifies all of the *Builder classes needed for the config, e.g. ... # using globs (foo.bar.* or foo.bar.**) will not work in Java9 due to classpath scanning limitations # so we enumarate every command (builder) we know this config uses below. (see SOLR-8876) importCommands : ["org.kitesdk.morphline.stdlib.LogDebugBuilder", "org.apache.solr.morphlines.solr.SanitizeUnknownSolrFieldsBuilder", "org.apache.solr.morphlines.solr.LoadSolrBuilder"] I opened an upstream issue: https://github.com/kite-sdk/kite/issues/469 The attached patch removes these problematic globs from all the test configs in solr, and removes all " SOLR-8876 " + Constants.JRE_IS_MINIMUM_JAVA9 related "assumes". With this patch, running morphline-core, morphline-cell, & map-reduce tests under java9 seem to pass/skip reliably (and failures found when using -Dtests.awaitsfix=true seem to match the existing test failures using -Dtests.awaitsfix=true with java8) I suggest we commit & backport this patch, but leave this jira open with a modified summary/description drawing attention to the morphlines config limitation in java9 and the workaround.
          Hide
          hossman Hoss Man added a comment -

          tweaked summary/description to reflect current state of situation.

          (should be updated/refined more – if/when we commit patch – to be more user centric)

          Show
          hossman Hoss Man added a comment - tweaked summary/description to reflect current state of situation. (should be updated/refined more – if/when we commit patch – to be more user centric)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4bc0636c1d188def7b221ed5c1235e9b6688471b in lucene-solr's branch refs/heads/branch_6x from Chris Hostetter
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4bc0636 ]

          SOLR-8876: change morphline test config files to work around 'importCommands' bug when using java9

          (cherry picked from commit 8756be05404758155b850748f807245fdaab6a8b)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4bc0636c1d188def7b221ed5c1235e9b6688471b in lucene-solr's branch refs/heads/branch_6x from Chris Hostetter [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4bc0636 ] SOLR-8876 : change morphline test config files to work around 'importCommands' bug when using java9 (cherry picked from commit 8756be05404758155b850748f807245fdaab6a8b)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8756be05404758155b850748f807245fdaab6a8b in lucene-solr's branch refs/heads/master from Chris Hostetter
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8756be0 ]

          SOLR-8876: change morphline test config files to work around 'importCommands' bug when using java9

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8756be05404758155b850748f807245fdaab6a8b in lucene-solr's branch refs/heads/master from Chris Hostetter [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8756be0 ] SOLR-8876 : change morphline test config files to work around 'importCommands' bug when using java9
          Hide
          hossman Hoss Man added a comment -

          i've committed the work around to our test configs.

          i'm updating the summary & description to target users who may face this problem.

          we should leave this issue open until the upstream bug is "fixed" in a future version and we've upgraded morphlines to use that version.

          Show
          hossman Hoss Man added a comment - i've committed the work around to our test configs. i'm updating the summary & description to target users who may face this problem. we should leave this issue open until the upstream bug is "fixed" in a future version and we've upgraded morphlines to use that version.
          Hide
          hossman Hoss Man added a comment -

          Actually, the "Workaround" resolution seems fitting for this.

          Show
          hossman Hoss Man added a comment - Actually, the "Workaround" resolution seems fitting for this.
          Hide
          markrmiller@gmail.com Mark Miller added a comment -

          I'm actually going to withdraw my veto from Steve's removal of the map-reduce contribs, so that would handle this case. Another option is to remove the cell contrib and add a more generic interface that morphlines can be plugged into external (or whatever logic). I've given it some time and it doesn't seem we are going to address the current issues in the near term though.

          Show
          markrmiller@gmail.com Mark Miller added a comment - I'm actually going to withdraw my veto from Steve's removal of the map-reduce contribs, so that would handle this case. Another option is to remove the cell contrib and add a more generic interface that morphlines can be plugged into external (or whatever logic). I've given it some time and it doesn't seem we are going to address the current issues in the near term though.
          Hide
          steve_rowe Steve Rowe added a comment -

          I'm actually going to withdraw my veto from Steve's removal of the map-reduce contribs

          Mark Miller, could you make a comment to this effect over on SOLR-9221 ?

          Show
          steve_rowe Steve Rowe added a comment - I'm actually going to withdraw my veto from Steve's removal of the map-reduce contribs Mark Miller , could you make a comment to this effect over on SOLR-9221 ?
          Hide
          thetaphi Uwe Schindler added a comment -

          Another option is to remove the cell contrib and add a more generic interface that morphlines can be plugged into external (or whatever logic)

          This is also something I would propose in general. This would allow to make some "cell" functionality that would use the TIKA server functionality. This would make the Solr distrib smaller and its no longer risky to crush the Solr server when the M$ Office parser runs out of memory! Instead you can simply restart the TIKA server in a separate JVM or instead use Morphlines, maybe also in separate JVM.

          Show
          thetaphi Uwe Schindler added a comment - Another option is to remove the cell contrib and add a more generic interface that morphlines can be plugged into external (or whatever logic) This is also something I would propose in general. This would allow to make some "cell" functionality that would use the TIKA server functionality. This would make the Solr distrib smaller and its no longer risky to crush the Solr server when the M$ Office parser runs out of memory! Instead you can simply restart the TIKA server in a separate JVM or instead use Morphlines, maybe also in separate JVM.

            People

            • Assignee:
              hossman Hoss Man
              Reporter:
              thetaphi Uwe Schindler
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development