Glassfishのインストール
Hudsonを使いたいので、じゃあTOMCATを使うかー、と思っていたのだが。Hudsonのドキュメントを見ると
もう1つの方法として、Glassfish、Tomcat 5、JBossおよびJettyなどのServlet 2.4/JSP 2.0をサポートするサーブレットコンテナがあるなら、他のWARファイルと同様に hudson.war をデプロイすることもできます。
と、なんだかTomcatよりもGlassfishというのをいかにもお勧めで書いてある。
そもそもGlassfishとはなんぞや、とググるとどうやら開発コアメンバーっぽい人がGlassfishとTomcatの違いなんて記事を書いていた。
インストール
どうやらSunが気合い入れてるっぽいし、TOMCATじゃないのも触ってみたいなと思ったので導入することにした。
Glassfishの導入ページから、現時点の安定版のv2.1をダウンロードする。(ああ、wgetが面倒臭い・・)
wget http://java.net/download/javaee5/v2.1_branch/promoted/Linux/glassfish-installer-v2.1-b60e-linux.jar
ダウンロードしたらインストールします。
java -Xmx256m -jar glassfish-installer-v2.1-b60e-linux.jar
-Xmx256mの最大ヒープサイズ指定をしないと、OutOfMemmoryErrorで落ちます。
Accept or Decline? [A,D,a,d]
ライセンスについての説明が出るので同意する(Accept)の「A」を押すとファイルの解凍が始まります。
「installation complete」
と出たら、次にセットアップを行います。
cd glassfish chmod -R +x lib/ant/bin lib/ant/bin/ant -f setup.xml
設定はantでやるみたいなので、実行権限を与えてantを実行します。
「BUILD SUCCESSFUL」
と出たら設定成功です。
そしたら起動してみます。
/usr/local/glassfish/bin/asadmin start-domain domain1 Starting Domain domain1, please wait. Default Log location is /usr/local/glassfish/domains/domain1/logs/server.log. Redirecting output to /usr/local/glassfish/domains/domain1/logs/server.log Domain domain1 is ready to receive client requests. Additional services are being started in background. Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)] with its configuration and logs at: [/usr/local/glassfish/domains]. Admin Console is available at [http://localhost:4848]. Use the same port [4848] for "asadmin" commands. User web applications are available at these URLs: [http://localhost:8080 https://localhost:8181 ]. Following web-contexts are available: [/web1 /__wstx-services ]. Standard JMX Clients (like JConsole) can connect to JMXServiceURL: [service:jmx:rmi:///jndi/rmi://%servername%:8686/jmxrmi] for domain management purposes. Domain listens on at least following ports for connections: [8080 8181 4848 3700 3820 3920 8686 ]. Domain does not support application server clusters and other standalone instances.
なんかApplicationServerがすでにあったら勝手に紐付してくれるようなメッセージだな・・・。
使用するポートは以下がデフォルトのようです。
(antでのbuildメッセージの最後に以下のようにメッセージが出ます)
create.domain:
[exec] Using port 4848 for Admin.
[exec] Using port 8080 for HTTP Instance.
[exec] Using port 7676 for JMS.
[exec] Using port 3700 for IIOP.
[exec] Using port 8181 for HTTP_SSL.
[exec] Using default port 3820 for IIOP_SSL.
[exec] Using default port 3920 for IIOP_MUTUALAUTH.
[exec] Using default port 8686 for JMX_ADMIN.とりあえず、メインのポートが8080てのは、TOMCATとどこかで競合しそうなので、これを変更したいです。
この設定の変更はビルド後、以下ファイルで変更できます。
/usr/local/glassfish/domains/domain1/config/domain.xml
<configs> <config dynamic-reconfiguration-enabled="true" name="server-config"> <http-service> <access-log format="%client.name% %auth-user-name% %datetime% %request% %status% %response.length%" rotation-enabled="true" rotation-interval-in-minutes="15" rotation-policy="time" rotation-suffix="yyyy-MM-dd"/> <http-listener acceptor-threads="1" address="0.0.0.0" blocking-enabled="false" default-virtual-server="server" enabled="true" family="inet" id="http-listener-1" port="8080" security-enabled="false" server-name="" xpowered-by="true"> <property name="proxiedProtocols" value="ws/tcp"/> </http-listener>
これの「8080」を「18080」に変更して再起動します。
「glassfish/bin/asadmin」のコマンドオプションが分からなかったので、ソースコードから追ってみたら、以下ファイルに記載があった。
glassfish\admin-cli\commands\src\java\com\sun\enterprise\cli\commands\CLIDescriptor.xml
って調べていたら「asadmin help」でヘルプが出ることに気づいた。
どちらにせよ、stop-domainしてstart-domainすればよさそうなので起動。
[root@%servername% bin]# ./asadmin stop-domain domain1 Domain domain1 stopped.
そしてスタートします。
[root@%servername% bin]# ./asadmin start-domain domain1 Starting Domain domain1, please wait. Default Log location is /usr/local/glassfish/domains/domain1/logs/server.log. Redirecting output to /usr/local/glassfish/domains/domain1/logs/server.log Domain domain1 is ready to receive client requests. Additional services are being started in background. Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)] with its configuration and logs at: [/usr/local/glassfish/domains]. Admin Console is available at [http://localhost:4848]. Use the same port [4848] for "asadmin" commands. User web applications are available at these URLs: [http://localhost:18080 https://localhost:8181 ]. Following web-contexts are available: [/web1 /__wstx-services ]. Standard JMX Clients (like JConsole) can connect to JMXServiceURL: [service:jmx:rmi:///jndi/rmi://%servername%:8686/jmxrmi] for domain management purposes. Domain listens on at least following ports for connections: [18080 8181 4848 3700 3820 3920 8686 ]. Domain does not support application server clusters and other standalone instances.
これでなんとか起動した。
あと、iptablesを開ける設定とApacheと連携をしないといけないが、続く
[...] Glassfishのインストールの続きです。 [...]