This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch branch_9_9
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9_9 by this push:
new 871811214ef SOLR-17883: Add <install>/lib to tool classpath (#3566)
871811214ef is described below
commit 871811214ef9f54e2071f14c386603f4eb5e9a1f
Author: Jason Gerlowski <[email protected]>
AuthorDate: Wed Oct 1 12:50:42 2025 -0400
SOLR-17883: Add <install>/lib to tool classpath (#3566)
Prior to this commit, the classpath for tools like "bin/solr zk"
consisted only of directories like `server/lib/ext` that already serve a
particular purpose (e.g. webapp libs, Jetty libs, etc). There was no
great place to put plugin jars needed by "bin/solr".
This commit addresses this by adding `<install>/lib` to the tool
classpath. This directory is already on Solr's classpath, so jars put
here are accessible by SolrCLI tools, as well as the Solr server proper.
---
solr/CHANGES.txt | 3 +++
solr/bin/solr | 2 +-
solr/bin/solr.cmd | 4 +--
.../modules/configuration-guide/pages/libs.adoc | 31 +++++++++-------------
4 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 4ba08947bbd..2ab708e225a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -24,6 +24,9 @@ Bug Fixes
* SOLR-3696: Fix for LB/Cloud SolrClients that could leak on close() if
concurrent request failed and triggered zombie server logic. (hossman)
+* SOLR-17883: SolrCLI tools such as "bin/solr zk" can now access jars located
in `<install_dir>/lib`.
+
+
Dependency Upgrades
---------------------
(No changes)
diff --git a/solr/bin/solr b/solr/bin/solr
index 6b44b4eb13e..d5a21ba42e5 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -519,7 +519,7 @@ function run_tool() {
"$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_ZK_CREDS_AND_ACLS:-}
${SOLR_TOOL_OPTS:-} -Dsolr.install.dir="$SOLR_TIP" \
-Dlog4j.configurationFile="$DEFAULT_SERVER_DIR/resources/log4j2-console.xml"
-Dsolr.pid.dir="$SOLR_PID_DIR" \
-Djava.io.tmpdir="$(cd "${TMPDIR:-${TEMP:-${TMP:-/tmp}}}"; pwd -P)" \
- -classpath
"$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*:$DEFAULT_SERVER_DIR/lib/*"
\
+ -classpath
"$SOLR_TIP/lib/*:$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*:$DEFAULT_SERVER_DIR/lib/*"
\
org.apache.solr.cli.SolrCLI "$@"
return $?
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 5cf1ad7d8c1..0260756f2e6 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -1263,7 +1263,7 @@ IF "%FG%"=="1" (
REM now wait to see Solr come online ...
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
%SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%"
-Dsolr.default.confdir="%DEFAULT_CONFDIR%"^
-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml"
^
- -classpath
"%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
+ -classpath
"%SOLR_TIP%\lib\*;%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
org.apache.solr.cli.SolrCLI status --max-wait-secs !SOLR_START_WAIT!
--solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:%SOLR_PORT%
IF NOT "!ERRORLEVEL!"=="0" (
set "SCRIPT_ERROR=Solr did not start or was not reachable. Check the
logs for errors."
@@ -1622,7 +1622,7 @@ if "!AUTH_PORT!"=="" (
)
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
%SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^
-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml"
^
- -classpath
"%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
+ -classpath
"%SOLR_TIP%\lib\*;%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
org.apache.solr.cli.SolrCLI auth %AUTH_PARAMS% --solr-include-file
"%SOLR_INCLUDE%" --auth-conf-dir "%SOLR_HOME%" ^
--solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!AUTH_PORT!
goto done
diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/libs.adoc
b/solr/solr-ref-guide/modules/configuration-guide/pages/libs.adoc
index 02910b1199b..06f5d4ab253 100644
--- a/solr/solr-ref-guide/modules/configuration-guide/pages/libs.adoc
+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/libs.adoc
@@ -1,4 +1,4 @@
-= Lib Directories and Directives
+= Lib Directories
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
@@ -26,27 +26,20 @@ If there is overlap or inter-dependencies between
libraries, then pay attention
== Lib Directories
-There are several special places you can place Solr plugin `.jar` files:
+There are several special places you can place Solr plugin `.jar` files,
described in the table below:
-* `<solr_home>/lib/`: The `.jar` files placed here are available to all Solr
cores running on the node, and to node level plugins referenced in `solr.xml`
-- so basically everything.
-This directory is not present by default so you will need to create it.
-See xref:deployment-guide:taking-solr-to-production.adoc[].
-* `<core_instance>/lib/`: In a user-managed cluster or a single-node
installation, you may want to add plugins just for a specific Solr core.
-Create this adjacent to the `<core_instance>/conf/` directory; it's not
present by default.
+[width="100%",options="header",]
+|===
+|Location |Visible To |Purpose |Additional Notes
+|`<solr_install>/lib/` | Everything (Node-level plugins, Core-level plugins,
`bin/solr` tools) |Any plugins that administrators want to make available to
all of Solrand its tooling, esp. when building a custom Solr package or
Dockerfile. |N/A
+|`<solr_home/lib/` | Node-level plugins, Core-level plugins |Useful when
plugins should be made available to all of Solr, but cannot be put in
`<solr_install>/lib/` for whatever reason (e.g. Solr installed on read-only
file system) | Directory not present by default and must be created by
administrators. See xref:deployment-guide:taking-solr-to-production.adoc[].
+|`<core_instance>/lib/` |Core-level plugins (for a specific core)
|User-managed clusters or single-node installations that want to make a plugin
visible to a specific Solr core, but not others. |Directory is not created by
default, and must be created by administrators adjacent to
`<core_instance>/conf/`
+|`<solr_install>/server/solr-webapp/webapp/WEB-INF/lib/` |Everything
(Node-level plugins, Core-level plugins, `bin/solr` tools) |Intended for Solr's
own jars and dependencies |Should not be used for plugins, except in the case
of a few rare plugin typs whose documentation explicitly calls out the need for
placement here.
+|`<solr_install>/server/lib/ext` |Everything (Node-level plugins, Core-level
plugins, `bin/solr` tools) |Intended to contain Jetty jars and other things
needed by the Jetty servlet classpath. Not typically used for plugins |N/A
+|===
-* `<solr_install>/lib/`: The `.jar` files placed here are available to all
Solr cores running on the node, and to node level plugins referenced in
`solr.xml` -- so basically everything.
-Contrary to `<solr_home>/lib/`, this directory is always located in the
install dir, so it can be used e.g. for custom
-Dockerfile to place custom plugin jars.
-
-* `<solr_install>/server/solr-webapp/webapp/WEB-INF/lib/`: The `.jar` files
for Solr itself and it's dependencies live here.
-Certain plugins or add-ons to plugins require placement here, and they will
have explicit documentation for this need.
-
-* `<solr_install>/server/lib/ext`: The `.jar` files used for the Solr server
as well as Solr Core/SolrJ.
-
-Solr incorporates Jetty for providing HTTP server functionality.
-Jetty has some directories that contain `.jar` files for itself and its own
plugins / modules or JVM level plugins (e.g., loggers).
-Solr plugins won't work in these locations.
+Note that while it's possible to place custom code in
`<solr_install>/server/solr-webapp/webapp/WEB-INF/lib/` and
`<solr_install>/server/lib/ext/`, doing so is discouraged as these directories
are intended for holding Solr and Jetty code, respectively.
== Lib Directives in SolrConfig