Skip to content
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

Formula elasticsearch@6 isn't working after openjdk has updated to 18 #100260

Closed
2 tasks done
linqueta opened this issue Apr 27, 2022 · 12 comments
Closed
2 tasks done

Formula elasticsearch@6 isn't working after openjdk has updated to 18 #100260

linqueta opened this issue Apr 27, 2022 · 12 comments
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@linqueta
Copy link

brew gist-logs <formula> link OR brew config AND brew doctor output

HOMEBREW_VERSION: 3.4.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: d0a0bbef8db45cca303c607037338d02d8eaa8ca
Last commit: 18 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 6d59f26a3e8fa552887c3f1c947b2fb0ec55983d
Core tap last commit: 68 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.36.0 => /opt/homebrew/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.0.1-arm64
CLT: 13.2.0.0.1.1638488800
Xcode: N/A
Rosetta 2: false

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

I'm trying to run elasticsearch@6 after I've run brew update.

What happened (include all command output)?

After brew update, the current version of openjdk was changed to 18 and elasticsearch@6 formula just depends of openjdk instead of passing a specific version of that (as was @17 7 days ago).

With this change, I started to receive the follow error and elasticsearch is not running anymore:

elasticsearch
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
	```

### What did you expect to happen?

I expect that after I type `elasticsearch` the service runs as it has run before `openjdk` upgrade.

### Step-by-step reproduction instructions (by running `brew` commands)

```shell
brew install elasticsearch@6

elasticsearch
@linqueta linqueta added the bug Reproducible Homebrew/homebrew-core bug label Apr 27, 2022
@linqueta
Copy link
Author

As a temporary solution, I had to create a local formula forcing the OpenJDK dependency to @17 and it's working right now.

@SMillerDev
Copy link
Member

An easier solution is setting JAVA_HOME to an older java version. I doubt we'll be fixing this unless someone submits a pull request since the software is deprecated and newer versions are not open source anymore.

@DakotaMichael
Copy link

DakotaMichael commented May 3, 2022

Saving this in case anyone else has this problem in the future. I was unable to launch elasticsearch@6 because of Java 18 compatibility issues, so I had to install the JDK 17 from here, and make sure that it was found first in the path:
export JAVA_HOME='/usr/libexec/java_home -v 17'
Then I had to reinstall elasticsearch, then the dependency openjdk (version 18).
When I ran brew services restart elasticsearch@6 all was well. I was able to curl 127.0.0.1:9200.

@SMillerDev
Copy link
Member

Alternative option: brew install openjdk@17 and follow the instructions it prints to set JAVA_HOME. You don't have to reinstall anything else but you will need to restart elastic search.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label May 24, 2022
@inkstak
Copy link

inkstak commented May 25, 2022

How do you make brew services to work with openjdk@17 ?

I've made:

brew install openjdk@17
export JAVA_HOME='/usr/libexec/java_home -v 17'
brew reinstall elasticsearch@6

Then starting manually ES with the elasticsearch command works while I stay in the same shell session.

But it won't work when I start ES from another session or through brew services
It'll report the same error as @linqueta reported:

Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)

@github-actions github-actions bot removed the stale No recent activity label May 25, 2022
@inkstak
Copy link

inkstak commented May 25, 2022

I've finally made it work, but I'm not sure this is the right call:

I've edited the service plist at /usr/local/Cellar/elasticsearch@6/6.8.23/homebrew.mxcl.elasticsearch@6.plist:

     <key>ProgramArguments</key>
     <array>
       <string>/usr/local/opt/elasticsearch@6/bin/elasticsearch</string>
     </array>
     <key>EnvironmentVariables</key>
     <dict>
+      <key>JAVA_HOME</key>
+      <string>'/usr/libexec/java_home -v 17'</string>
     </dict>

I had to edit the plist in the Cellar folder instead of the one in ~/Library/LaunchAgents because brew services is overwriting it at every start.

@linqueta
Copy link
Author

I was having the same problem using brew services start elasticsearch@6. Thanks @inkstak !

@linqueta
Copy link
Author

@inkstak I've tried to edit the same file as you did but I keep having the same error:

homebrew/var/log  stable ✔
▶ cat elasticsearch.log
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
	at java.base/java.lang.System.setSecurityManager(System.java:416)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:83)
warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.```

@inkstak
Copy link

inkstak commented May 25, 2022

That's akward: ES seems to run without any issue after booting, but I cannot start it manually.
I've got the same error when running elasticsearch or brew services restart elasticsearch@6.

Lastly I tried to revert changes on the plist file and remove openjdk while keeping openjdk@17.

$ brew uninstall openjdk
Error: Refusing to uninstall /usr/local/Cellar/openjdk/18.0.1
because it is required by elasticsearch@6, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies openjdk

$ brew uninstall --ignore-dependencies openjdk
(..)

$ brew reinstall openjdk@17
(..)

$ java -version
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Homebrew (build 17.0.3+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.3+0, mixed mode, sharing)

$ /usr/libexec/java_home
/usr/local/Cellar/openjdk@17/17.0.3/libexec/openjdk.jdk/Contents/Home

With only one version of java running locally, it seems to work:

  • ES is started after rebooting
  • I can restart the service with homebrew
  • I can start an elasticsearch process manually

However, that's not a permanent solution:

  • homebrew will complain about broken dependencies and is likely to reinstall openjdk at any moment
  • you may also have some libraries depending on Java 18.

It'll keep looking for a better approach.

@SMillerDev
Copy link
Member

You also need to set JAVA_HOME in your shell if you want to start elasticsearch manually.

@SMillerDev
Copy link
Member

I'm closing this since the formula is deprecated.

@SMillerDev SMillerDev closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
@github-actions github-actions bot added the outdated PR was locked due to age label Jun 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

4 participants