[Java] Elasticsearch service on Windows will not start if -javaagent is specified but runs fine if started manually

By adding -javaagent and -Dnewrelic.config.file to ES_JAVA_OPS variable I am able to start Elasticsearch manually from the command line. However, it fails to start as a Windows service and the only error reported in Windows System Error is “Incorrect function.” When adding those to other Windows services (e.g. tomcat and wildfly) everything works with no issue. Any idea why?

Hi @mrakhsha

Thanks for reaching out here, I hope you are well.

Its great to see your first post here in the community!

I will need a little more clarity here, is there a permalink / screenshot you can provide where you see the issue. As it may help us determine exactly whats happening.

Looking forward to hearing from you!

Hi @dcody

Here is a screenshot of the response when the service is started:

System Event Viewer simply states “The Liaison-Elasticsearch-es01 service terminated unexpectedly. It has done this 2 time(s).” (I am limited to 2 screenshots)

Here is a screenshot of the Apache common log after the service terminates:

Elasticsearch with new relic javaagent comes up fine if started from CMD, it only fails as a service.

Hello @mrakhsha

Thank you for the screen shots and providing the extra context surrounding them. I am going to loop in an engineer from our Java team to help out here as this is a bit out of my scope. We appreciate your patience as we provide support. Please let us know if anything changes. Have a great day!

Hello @mrakhsha -

This is currently intended functionality - we do not support Elastic Search Applications explicitly at this time . This means that:

  1. We have no specific installation steps for it;
  2. We don’t test against it;
  3. We have no specific out-of-the-box functionality for it, and
  4. We cannot provide further assistance.

In this case, you can still start the agent manually, and you can submit. feature directly to us using the Submit Feedback button up in the top right corner of the UI. I know it’s easy to feel as though these ‘feedback’ buttons are just sending comments into the void, but anything you send us is directly reviewed by the relevant product manager! So please do send us your suggestions and comments.

Thanks. Feedback submitted.

Hey @mrakhsha,

Please reach out if we can assist with anything else!