Bug report:
Elasticsearch version: 6.2.4
Plugins installed: None
JVM version: 1.8.0_171
OS version: Windows 10 (1511)
Description of the problem including expected versus actual behavior:
I cannot start elastic search using elasticsearch.bat
.
The error message is: \Common was unexpected at this time.
Fix
%JAVA% is assigned C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
in elasticsearch-env.bat
.
This breaks the last for loop in elasticsearch.bat
. This can be fixed be changing it to
for /F "usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_JVM_OPTIONS!" ^|^| echo jvm_options_parser_failed`) do set JVM_OPTIONS=%%a
Pinging @elastic/es-core-infra
I found https://github.com/elastic/elasticsearch/pull/28753 which might be related but that should have been fixed in 6.2.3. Not sure if this is a different issue.
I had the same issue in windows
Added JAVA_HOME in Environmetn Variable --> System Variables section.
It worked
@sathiql JAVA_HOME is assigned, the problem is with the parentheses in the path. Does your path contain parentheses?
My Windows 10 with java SE x64 version 1.8.0_171-b11 running Elasticsearch 6.2.4 also had this problem
I added the fix to the bat file and it worked.
In my Path variable there is this path:
C:Program Files (x86)\Common Files\Oracle\Java\javapath
which I guess is some kind of symbolic link folder to my current x64 java (special icon, only java, javaw and javaws exe). I think it is the culprit.
I have no JAVA_HOME and adding one did not help.
Thanks, @Dobatymo for the fix! It works in general, but the result will be that only first option from jvm.options file will be picked up. Here is the updated version (with added _delims=_ option) that picks all JVM options:
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_JVM_OPTIONS!" ^|^| echo jvm_options_parser_failed`) do set JVM_OPTIONS=%%a
Still the same issue in v6.3.0
Another issue that is in the elasticsearch.bat is just 2 lines above "for /F". It starts with set "ES_JVM_OPTIONS=
It has double quotes between "set" and variable name. These quotes are not really needed because in the command below that variable is enclosed in the quotes anyway.
So, the full working snippet that works for me looks like the following
set ES_JVM_OPTIONS=%ES_PATH_CONF%\jvm.options
@setlocal
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_JVM_OPTIONS!" ^|^| echo jvm_options_parser_failed`) do set JVM_OPTIONS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%JVM_OPTIONS%" & set ES_JAVA_OPTS=%JVM_OPTIONS:${ES_TMPDIR}=!ES_TMPDIR!% %ES_JAVA_OPTS%
This is reproducible in Windows Server 2016 when JAVA_HOME
has parenthesis, like in Program Files (x86)
.
I've resolved this with the below two steps on Windows 10 - 64 bit machine using Command Line Installer for ElasticSearch 6.4.2
Added an environment variable JAVA_HOME to the System Environment varaibles.
In the ElasticSearch.bat
replace
for /F "usebackq delims=" %%a in (`"%JAVA% -cp "!ES_CLASSPATH!" blah blah
with
for /F "usebackq delims=" %%a in (`"!JAVA! -cp "!ES_CLASSPATH!" blah blah
it worked like a charm for me...
PS:
The startup then hit an issue:
_[2018-10-09T18:20:49,158][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [Sree_Cluster1_node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.2.jar:6.4.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.2.jar:6.4.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.2.jar:6.4.2]_
This one got resolved by adding xpack.ml.enabled: false to the elasticsearch.yml
Hi All,
if your java is installed under C:Program Files (x86) then set the JAVA_HOME like will below
set JAVA_HOME=C:\Progra~2\Java\jre1.8.0_131
if your java is installed under C:\Program Files then set the JAVA_HOME like will below
set JAVA_HOME=C:\Progra~1\Java\jre1.8.0_131
After that try to start the elastic search, it should start then.
Thanks & Regards
Jaiswar Vipin Kumar R
Most helpful comment
Still the same issue in v6.3.0
Another issue that is in the elasticsearch.bat is just 2 lines above "for /F". It starts with set "ES_JVM_OPTIONS=
It has double quotes between "set" and variable name. These quotes are not really needed because in the command below that variable is enclosed in the quotes anyway.
So, the full working snippet that works for me looks like the following