diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c1a36aa4154..f41a84bff19 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -207,6 +207,9 @@ Bug Fixes * SOLR-14774: HealthCheckHandler is no longer an implicit SolrCore handler and can be configured from solr.xml (Tomás Fernándex Löbbe) +* SOLR-14714: Solr.cmd in windows loads the incorrect jetty module when using java>=9 (Endika Posadas via + Erick Erickson) + Other Changes --------------------- diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index b4e17409dcd..e7700175974 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -42,6 +42,31 @@ IF EXIST "%SOLR_INCLUDE%" CALL "%SOLR_INCLUDE%" set "DEFAULT_SERVER_DIR=%SOLR_TIP%\server" + +REM Verify Java is available +IF DEFINED SOLR_JAVA_HOME set "JAVA_HOME=%SOLR_JAVA_HOME%" +REM Try to detect JAVA_HOME from the registry +IF NOT DEFINED JAVA_HOME ( + FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment" /v CurrentVersion') DO set CurVer=%%B + FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\!CurVer!" /v JavaHome') DO ( + set "JAVA_HOME=%%B" + ) +) +IF NOT DEFINED JAVA_HOME goto need_java_home +set JAVA_HOME=%JAVA_HOME:"=% +IF %JAVA_HOME:~-1%==\ SET JAVA_HOME=%JAVA_HOME:~0,-1% +IF NOT EXIST "%JAVA_HOME%\bin\java.exe" ( + set "SCRIPT_ERROR=java.exe not found in %JAVA_HOME%\bin. Please set JAVA_HOME to a valid JRE / JDK directory." + goto err +) +set "JAVA=%JAVA_HOME%\bin\java" +CALL :resolve_java_info +IF !JAVA_MAJOR_VERSION! LSS 8 ( + set "SCRIPT_ERROR=Java 1.8 or later is required to run Solr. Current Java version is: !JAVA_VERSION_INFO! (detected major: !JAVA_MAJOR_VERSION!)" + goto err +) + + REM Select HTTP OR HTTPS related configurations set SOLR_URL_SCHEME=http set "SOLR_JETTY_CONFIG=--module=http" @@ -185,29 +210,6 @@ IF "%SOLR_JETTY_HOST%"=="" ( set "SOLR_JETTY_HOST=127.0.0.1" ) -REM Verify Java is available -IF DEFINED SOLR_JAVA_HOME set "JAVA_HOME=%SOLR_JAVA_HOME%" -REM Try to detect JAVA_HOME from the registry -IF NOT DEFINED JAVA_HOME ( - FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment" /v CurrentVersion') DO set CurVer=%%B - FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\!CurVer!" /v JavaHome') DO ( - set "JAVA_HOME=%%B" - ) -) -IF NOT DEFINED JAVA_HOME goto need_java_home -set JAVA_HOME=%JAVA_HOME:"=% -IF %JAVA_HOME:~-1%==\ SET JAVA_HOME=%JAVA_HOME:~0,-1% -IF NOT EXIST "%JAVA_HOME%\bin\java.exe" ( - set "SCRIPT_ERROR=java.exe not found in %JAVA_HOME%\bin. Please set JAVA_HOME to a valid JRE / JDK directory." - goto err -) -set "JAVA=%JAVA_HOME%\bin\java" -CALL :resolve_java_info -IF !JAVA_MAJOR_VERSION! LSS 8 ( - set "SCRIPT_ERROR=Java 1.8 or later is required to run Solr. Current Java version is: !JAVA_VERSION_INFO! (detected major: !JAVA_MAJOR_VERSION!)" - goto err -) - set FIRST_ARG=%1 IF [%1]==[] goto usage @@ -406,13 +408,13 @@ goto done :healthcheck_usage @echo. -@echo Usage: solr healthcheck [-c collection] [-z zkHost] [-V] +@echo Usage: solr healthcheck [-c collection] [-z zkHost] [-V] @echo. @echo Can be run from remote (non-Solr^) hosts, as long as a proper ZooKeeper connection is provided @echo. @echo -c collection Collection to run healthcheck against. @echo. -@echo -z zkHost Zookeeper connection string; unnecessary if ZK_HOST is defined in solr.in.cmd; +@echo -z zkHost Zookeeper connection string; unnecessary if ZK_HOST is defined in solr.in.cmd; @echo otherwise, default is localhost:9983 @echo. @echo -V Enable more verbose output @@ -558,8 +560,8 @@ echo. ^, ^ : [file:][/]path/to/local/file or zk:/path/t echo NOTE: ^ and ^ may both be Zookeeper resources prefixed by 'zk:' echo When ^ is a zk resource, ^ may be '.' echo If ^ ends with '/', then ^ will be a local folder or parent znode and the last -echo element of the ^ path will be appended unless ^ also ends in a slash. -echo ^ may be zk:, which may be useful when using the cp -r form to backup/restore +echo element of the ^ path will be appended unless ^ also ends in a slash. +echo ^ may be zk:, which may be useful when using the cp -r form to backup/restore echo the entire zk state. echo You must enclose local paths that end in a wildcard in quotes or just echo end the local path in a slash. That is, @@ -2046,8 +2048,10 @@ FOR /f "usebackq tokens=3" %%a IN (`^""%JAVA%" -version 2^>^&1 ^| findstr "versi REM Remove surrounding quotes set JAVA_VERSION_INFO=!JAVA_VERSION_INFO:"=! + echo "java version info is !JAVA_VERSION_INFO!" REM Extract the major Java version, e.g. 7, 8, 9, 10 ... for /f "tokens=1,2 delims=._-" %%a in ("!JAVA_VERSION_INFO!") do ( + echo "Extracted major version is %%a" if %%a GEQ 9 ( set JAVA_MAJOR_VERSION=%%a ) else (