Skip to content

Clearer error message - installing windows service #33804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2019
Merged

Clearer error message - installing windows service #33804

merged 2 commits into from
Mar 4, 2019

Conversation

nogginbox
Copy link
Contributor

@nogginbox nogginbox commented Sep 18, 2018

The error message reports it can not find a file in a directory it was not looking for it in.

I've updated the message so it makes it clearer what JAVA_HOME is set to and which directories it tried to find jvm.dll in.

I spent more time than I should have done trying alternate values for JAVA_HOME to try and fix this error, so this error message should save others from this fate. Turns out I got this error because I had installed the client version of Java and not the SE version, and this puts jvm.dll in a different folder inside JAVA_HOME.

The error message reports it can not find a file in a directory it was not looking for it in.

I've updated the message so it makes it clearer what JAVA_HOME is set to and which directories it tried to find jvm.dll in
@nogginbox
Copy link
Contributor Author

This is only a small change to wording, but I've signed the contributor's agreement as requested.

@javanna javanna added the :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts label Sep 18, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@javanna
Copy link
Member

javanna commented Sep 18, 2018

test this please

@jasontedor
Copy link
Member

I think that we will need manual testing here too since our PR CI does not currently cover Windows.

@nogginbox
Copy link
Contributor Author

I manually tested this to make sure it printed the error as I expected it to.

The easiest way to test (if you have the correct version of java installed) is to change the value of JAVA_HOME to something wrong and then run.

@danielmitterdorfer danielmitterdorfer self-requested a review January 16, 2019 14:25
@danielmitterdorfer
Copy link
Member

danielmitterdorfer commented Jan 23, 2019

Thanks for the PR. I have tested now several scenarios on different Java versions (Java 8 and Java 10 with Elasticsearch 6.5.2) on Windows Server 2012R2. If %JAVA_HOME% points to an invalid directory I get:

could not find java; set JAVA_HOME or ensure java is in PATH

If I remove / rename jvm.dll (in the respective directory), I get a clear error message what's wrong:

Error: missing server' JVM at C:\Program Files\Java\jdk-10.0.1\bin\server\jvm.dll'.
Please install or use the JRE or JDK that contains these missing components.

(which is raised by the JVM itself when Elasticsearch attempts to invoke java)

So I wonder whether this change is actually needed as we never seem to hit this error condition.

@nogginbox
Copy link
Contributor Author

nogginbox commented Jan 25, 2019

It's a while ago now, but I think the reason I got the message was I had two editions of java installed and JAVA_HOME was pointing at the wrong one. The folder existed, but the file did not or the directory structure in JAVA_HOME was different. Seeing the path in the error, would have helped me spot this. I would have found this helpful, but perhaps others would not.

@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

@danielmitterdorfer
Copy link
Member

Just fyi: I have merged the latest master on your behalf to ensure all required PR checks can run successfully. No need to do anything on your end.

@danielmitterdorfer danielmitterdorfer merged commit ceb7051 into elastic:master Mar 4, 2019
danielmitterdorfer pushed a commit to danielmitterdorfer/elasticsearch that referenced this pull request Mar 4, 2019
The error message reports it can not find a file in a directory it was not looking for it in.

I've updated the message so it makes it clearer what JAVA_HOME is set to and which directories it tried to find jvm.dll in
@danielmitterdorfer
Copy link
Member

Thanks for your PR. I've merged it now and it will be released in Elasticsearch 7.1.0.

danielmitterdorfer added a commit that referenced this pull request Mar 5, 2019
With this commit we provide more info in an existing error message that is
raised when the file `jvm.dll` cannot be found on Windows when installing
Elasticsearch as a service.
@danielmitterdorfer
Copy link
Member

Backported to 7.x in #39652

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >enhancement Team:Delivery Meta label for Delivery team v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants