LoginSignup
1
2

More than 3 years have passed since last update.

HomebrewでGlassFishかPayaraをインストールする

Last updated at Posted at 2017-05-17

Payara5

# 使う前にはアップデートする
% brew update
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/cask-fonts).
==> New Formulae
# ...省略...
aliwangwang             aspera-connect          blizz                   daedalus                docear                  yandexradio             zoomin
% brew --version
Homebrew 2.5.11
Homebrew/homebrew-core (git revision 81faa9; last commit 2020-11-17)
Homebrew/homebrew-cask (git revision 2c26b; last commit 2020-11-17)

# 使う前にはお医者さんにかかっておく・・・あっ・・・OSがサポートされていない・・・けど使えるから気にしない
% brew doctor                                    
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don`t worry or file an issue; just ignore this. Thanks!

Warning: You are using macOS 11.0.
We do not provide support for this released but not yet supported version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew`s GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
released but not yet supported version.

# Payaraがあることを確認しておく
% brew search payara
==> Formulae
payara

# インストールする
% brew install payara
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 10 formulae.

Warning: You are using macOS 11.0.
We do not provide support for this released but not yet supported version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew`s GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
released but not yet supported version.

==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.37.big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/a8f1c35f9f004c4f7878c30027e35a9fb9551782df963f88deebd3dc29d94d51?response-content-disposition=attachment%3Bfilen
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.10.4.big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/01b464b98584ba5777d8fc4605121c7a46e713a2f58d729197b82afef1b5f2b9?response-content-disposition=attachment%3Bfilen
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/openjdk%408-1.8.0%2B275.big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/b37ae302878e8bdbfaaa9eb085c7315bef27c09fee834c1e43a7540b2b986d5a?response-content-disposition=attachment%3Bfilen
######################################################################## 100.0%
==> Downloading https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/5.192/payara-5.192.zip
==> Downloading from https://repo1.maven.org/maven2/fish/payara/distributions/payara/5.192/payara-5.192.zip
######################################################################## 100.0%
==> Installing dependencies for payara: libpng, freetype and openjdk@8
==> Installing payara dependency: libpng
==> Pouring libpng-1.6.37.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.37: 27 files, 1.3MB
==> Installing payara dependency: freetype
==> Pouring freetype-2.10.4.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/freetype/2.10.4: 64 files, 2.3MB
==> Installing payara dependency: openjdk@8
==> Pouring openjdk@8-1.8.0+275.big_sur.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk

openjdk@8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have openjdk@8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk@8 you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"

==> Summary
🍺  /usr/local/Cellar/openjdk@8/1.8.0+275: 742 files, 192.9MB
==> Installing payara
==> Caveats
You may want to add the following to your .bash_profile:
  export GLASSFISH_HOME=/usr/local/opt/payara/libexec/glassfish
  export PATH=${PATH}:${GLASSFISH_HOME}/bin

To have launchd start payara now and restart at login:
  brew services start payara
Or, if you don`t want/need a background service you can just run:
  asadmin start-domain --verbose domain1
==> Summary
🍺  /usr/local/Cellar/payara/5.192_1: 2,002 files, 176.7MB, built in 5 seconds
==> Caveats
==> openjdk@8
For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk

openjdk@8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have openjdk@8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk@8 you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"

==> payara
You may want to add the following to your .bash_profile:
  export GLASSFISH_HOME=/usr/local/opt/payara/libexec/glassfish
  export PATH=${PATH}:${GLASSFISH_HOME}/bin

To have launchd start payara now and restart at login:
  brew services start payara
Or, if you don`t want/need a background service you can just run:
  asadmin start-domain --verbose domain1

# JDK8用の環境変数を設定する
% echo 'export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"' >> ~/.zshrc
% echo 'export JAVA_HOME="/usr/local/opt/openjdk@8/bin"' >> ~/.zshrc
% echo 'export PATH=${JAVA_HOME}:${PATH}' >> ~/.zshrc

# Pyara用の環境変数を設定する
% echo 'export GLASSFISH_HOME=/usr/local/opt/payara/libexec/glassfish' >> ~/.zshrc 
% echo 'export PATH=${PATH}:${GLASSFISH_HOME}/bin' >> ~/.zshrc

# .zshrcの設定を反映する
% source ~/.zshrc

起動してみる

% asadmin
Use "exit" to exit and "help" for online help.
Remote commands not fetched

# バージョンを見てみる
asadmin> version
Version string could not be obtained from Server [localhost:4848].
(Turn debugging on e.g. by setting AS_DEBUG=true in your environment, to see the details.)
Using locally retrieved version string from version class.
Version = Payara Server  5.192 #badassfish (build 115)
Command version executed successfully.

# 起動する
asadmin> start-domain domain1
Waiting for domain1 to start ..................................................
Successfully started the domain : domain1
domain  Location: /usr/local/Cellar/payara/5.192_1/libexec/glassfish/domains/domain1
Log File: /usr/local/Cellar/payara/5.192_1/libexec/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
asadmin> 

http://localhost:4848/ をみてみる
スクリーンショット 2020-12-15 21.15.40.png

java11だとうまく起動しない・・・

java11をPATHに通しているとうまく起動しない・・・
# java11を設定していると・・・
% java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+11)
OpenJDK 64-Bit Server VM (build 11.0.8+11, mixed mode)

# 起動しない・・・どうやってjava11を設定すればいいのか・・・
% asadmin start-domain domain1                                                               
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:

Unrecognized option: --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Command start-domain failed.

domain.xmlにある<jvm-options>の指定で--add-opensの直後に「=」を
Eclipseで起動する場合は入れない
asadminコマンドで起動する場合は入れるという情報を見つけた。

エラーになっている箇所は、domain.xmlで<jvm-options>[9|]--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED</jvm-options>となっている。
試しに「=」をスペースに変えて<jvm-options>[9|]--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</jvm-options>にしてみたらちょっと進んだ。

# エラーになるオプションがdomain.xmlで変更した行の3行下の内容になった
% asadmin start-domain
...省略...
Unrecognized option: --add-opens=java.base/java.nio=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Command start-domain failed.
# さっきと同様に「=」をスペースに変えてみたがエラーになる・・・どうすれば・・・
% asadmin start-domain
...省略...
Unrecognized option: --add-opens java.base/java.nio=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Command start-domain failed.

Payara6になるとJava11がデフォルトで使えるようになりそうだ。

Payara 6
2021年に予定されているPayara Platform 6には,次のような機能が含まれる予定である — ソースコードの分解と再構築; 完全なJavarta EE 9認証; JDK 11+ ベース,すなわち,JDK 11による完全なコンパイルとビルドの実施; 新たな管理コンソールと監視用コンソール; Springのネイティブサポート。
Payara Platform 5の2019年のロードマップ

有効期限が切れているSSL証明書を削除する

有効期限が切れているSSL証明書を削除する - Qiita

Eclipseに設定してみる

  • 環境 : Eclipse IDE for Enterprise Java Developers Version: 2020-12 M1 (4.18.0 M1)

EclipseにPayaraを設定する方法 - Qiita

GlassFish4

GlassFish4がほしいと思ってダウンロードページに出かけたら・・・閉鎖されていた:scream:
GlassFish Commercial Editionの提供が終了

https://glassfish.java.net/download.html
Screen Shot 2017-05-18 at 0.17.43.png

JavaEE7に同梱されているみたいだけど・・・GlassFish4だけ欲しい・・・
Screen Shot 2017-05-18 at 0.19.16.png

欲しいものは欲しいのでHomebrewでGlassFish4をインストールすることにしました。
Glassfish — BrewFormulas

  • 環境
    • macOS Sierra version10.12.4 64bit
    • Homebrew 1.2.1
# 1. Homebewを更新する
$ brew update

# 2. GlassFishをインストールする
$ brew install glassfish
==> Using the sandbox
==> Downloading http://download.java.net/glassfish/4.1.2/release/glassfish-4.1.2.zip
######################################################################## 100.0%
==> Caveats
The home of GlassFish Application Server 4 is:
  /usr/local/opt/glassfish/libexec

You may want to add the following to your .bash_profile:
  export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
  export PATH=${PATH}:${GLASSFISH_HOME}/bin

Note: The support scripts used by GlassFish Application Server 4
are *NOT* linked to bin.
==> Summary
🍺  /usr/local/Cellar/glassfish/4.1.2: 1,005 files, 126.6MB, built in 1 minute 30 seconds

起動してみる

$ sudo /usr/local/Cellar/glassfish/4.1.2/libexec/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin> start-domain domain1
Waiting for domain1 to start .........................................
Successfully started the domain : domain1
domain  Location: /usr/local/Cellar/glassfish/4.1.2/libexec/glassfish/domains/domain1
Log File: /usr/local/Cellar/glassfish/4.1.2/libexec/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
asadmin> 

http://localhost:4848/ をみてみる
Screen Shot 2017-05-18 at 0.48.58.png

Eclipseに設定してみる

  • 環境 : Eclipse : Neon.3 Release (4.6.3)

Screen Shot 2017-05-18 at 0.52.58.png
Screen Shot 2017-05-18 at 0.53.10.png
Screen Shot 2017-05-18 at 0.53.27.png

データベースを設定してみる

Screen Shot 2017-05-18 at 0.56.58.png
Screen Shot 2017-05-18 at 0.57.12.png
Screen Shot 2017-05-18 at 1.00.30.png

  • [Next...]をクリックしたら「HTTP Status 500 - Internal Server Error」になった場合
    • /usr/local/Cellar/glassfish/4.1.2/libexec/glassfish/domain/domain1/configにある domain.xml にデータベースの情報をガチで書く

Screen Shot 2017-05-18 at 1.01.08.png

使いたいデータベースの情報を入れる。
Screen Shot 2017-05-18 at 1.03.20.png

参考にさせていただいたサイト様

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2