Error loading class 'solr.ICUCollationField' whilst setting up core

Created on 25 November 2018, over 6 years ago
Updated 27 January 2025, 6 months ago

Setting up SOLR locally on my macbook pro using homebrew. After I added the downloaded config files I get this error on http://127.0.0.1:8983/solr/#/d8

d8: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core d8: Can't load schema /usr/local/opt/solr/server/solr/d8/conf/schema.xml: Plugin init failure for [schema.xml] fieldType "collated": Error loading class 'solr.ICUCollationField'

From googling it says I need to link some libraries but not really understanding. Discovered this issue which was recent that added this so wondering if it's just the install instructions haven't been updated - I've not done anything custom:

https://www.drupal.org/project/search_api_solr/issues/3009943 β†’

πŸ“Œ Task
Status

Fixed

Component

Documentation

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mikegodin

    I was just encountering the ICUCollationField issue with Search API Solr 4.3.7 and Solr 9.8.0, and found the previous solutions did not work, but the following two solutions did work:

    1. Either add the following line to /etc/default/solr.in.sh:
    $SOLR_OPTS -Dsolr.sharedLib=/opt/solr/modules/analysis-extras/lib"

    2. Or copy the contents of:
    /opt/solr/modules/analysis-extras/lib
    to
    /opt/solr/server/solr-webapp/webapp/WEB-INF/lib

  • Hi, I have encountered the same issue with Search API Solr 4.3.7 and Solr 9.8.0. I found the following at the Logging page of Solr config;

    WARN false
    
    d8
    
    SolrConfig
    
    Configset references one or more <lib/> directives,&#8203; but <lib/> usage is disabled on this Solr node. Either remove all <lib/> tags from the relevant configset,&#8203; or <strong>enable use of this feature by setting 'solr.config.lib.enabled=true'</strong>
    

    I have taken another solution and it works.
    sudo vi /etc/default/solr.in.sh

    SOLR_OPTS="$SOLR_OPTS -Dsolr.config.lib.enabled=true"
    

    Major Changes in Solr 9.8: https://solr.apache.org/guide/solr/latest/upgrade-notes/major-changes-in-solr-9.html#solr-9-8

  • πŸ‡¨πŸ‡­Switzerland znerol

    For people running solr in containers: This can be fixed by supplying module configuration via the SOLR_MODULES environment variable.

    The following value loads all the modules referenced from solrconfig.xml currently shipped by Search API Solr module:

    SOLR_MODULES=extraction,langid,ltr,analysis-extras
    
  • πŸ‡ͺπŸ‡ΈSpain sblasco

    Hello!,

    As says znerol, if you edit your docker-compose.yml and you add this to the file, the issue will be fixed:

    solr:
    image: wodby/solr:$SOLR_TAG
    container_name: "${PROJECT_NAME}_solr"
    environment:
    SOLR_MODULES: extraction,langid,ltr,analysis-extra

    The important part is "SOLR_MODULES:"

    It will be neccesary restart the container

  • πŸ‡ͺπŸ‡ΈSpain sblasco

    Hello!,

    As says znerol, if you edit your docker-compose.yml and you add this to the file, the issue will be fixed:

    solr:
    image: wodby/solr:$SOLR_TAG
    container_name: "${PROJECT_NAME}_solr"
    environment:
    SOLR_MODULES: extraction,langid,ltr,analysis-extras

    The important part is "SOLR_MODULES:"

    It will be neccesary restart the container

  • πŸ‡΅πŸ‡±Poland michal_liszka

    I encountered the same issue with DDEV while upgrading Solr from version 8 to 9.

    To fix it, I had to add the following to docker-compose.solr.yaml:

    services:
        solr:
            build:
                args:
                   SOLR_BASE_IMAGE: ${SOLR_BASE_IMAGE:-solr:9}
              environment:
                  - SOLR_MODULES=extraction,langid,ltr,analysis-extras,scripting
    

    And in .ddev/solr/conf/solrconfig.xml, I had to update the XSLTResponseWriter class:

      - <queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
      + <queryResponseWriter name="xslt" class="solr.scripting.xslt.XSLTResponseWriter">
    

    After these changes, all communication started working correctly.

    Maybe it will help someone :)

  • πŸ‡ΊπŸ‡ΈUnited States dereks

    #37 got things working for me, after much hair pulling.

    Thanks!

  • πŸ‡³πŸ‡±Netherlands ndf Amsterdam
  • πŸ‡ΊπŸ‡ΈUnited States bburg Washington D.C.

    #40 solved it for me. Specifically:

              environment:
                  - SOLR_MODULES=extraction,langid,ltr,analysis-extras,scripting
    

    Was all that I needed for my ddev environment. Specifically using the latest ddev/ddev-solr.

  • πŸ‡ΊπŸ‡ΈUnited States bburg Washington D.C.

    I was re-examining this today trying to understand why I was running into the issue in the first place. Confusingly, after removing the lines I mentioned in my previous comment, and the lines mentioned in comment #4 in πŸ’¬ Error loading class 'solr.ICUCollationField' Fixed , I saw that my local solr was still automatically creating the collection instead of running into the error from before. I believe the only difference was that I had updated my config set. Looking at the git log, I saw that I had replaced versions of the module dir settings - e.g. these lines - replacing versions that looked more like the jump start templates

    I'm not certain how I ended up with the jumpstart version of the config set rather than what's in the template, but this is something to be on the watch out for, as I'm thinking that the environment variable fix isn't necessary if you are using a config set generated from the correct templates.

  • πŸ‡¨πŸ‡­Switzerland znerol

    @bburg from the Solr 9.8 release notes:

    <lib/> directives have been made into an "opt-in" feature in Solr 9.8 and must be explicitly enabled if desired (using a system property or environment variable like -Dsolr.config.lib.enabled=true) If not explicitly enabled, Solr will log a warning but otherwise quietly ignore any <lib/> tags in configsets. This is a breaking change, and we apologize for the disruption, but it’s a necessary response to a number of security gaps that have come to light around this feature. <lib/> directives should be considered deprecated and will be removed entirely in Solr 10.0. Current users of <lib/> have a number of options to ensure their libraries remain on Solr’s classpath, including: SOLR_MODULES, core "lib" directories, the solr.xml <sharedLib> tag, Solr’s package manager, etc.

    It follows that:

    • If you have these lines (uncommented) in your config, then you are relying on a deprecated feature.
    • In order to use such a config, you need to specify -Dsolr.config.lib.enabled=true on the command line.
    • It is recommended to rely on SOLR_MODULES=extraction,langid,ltr,analysis-extras,... to be prepared for Solr 10
Production build 0.71.5 2024