「Resin」インストール、アプリケーションをデプロイしてみる

TomcatJBossWebLogic あたりは仕事で触る機会が多いんですが、Resin は機会に恵まれずいままで触らずでした。今回、ようやく機会があって触ってみたので、インストール、アプリケーションのデプロイ方法をメモしておきます。

Resin ( 4 系 ) は、Java EE 6 Web Profile を実装したアプリケーションサーバになります。
Web Profile は Web アプリケーションを対象にした仕様という感じですね。

・JSR-000316 Java Platform, Enterprise Edition 6 Specification 6.0 Final Release
http://download.oracle.com/otndocs/jcp/javaee_web_profile-6.0-fr-eval-oth-JSpec/

Java EE Compatibility
http://www.oracle.com/technetwork/java/javaee/overview/compatibility-jsp-136984.html


余談入りましたが、以下手順です。

1. インストール


今回は、現時点 ( 2015/04/18 )、最新版の Resin 4.0.43 を使いました。以下からダウンロードします。

・Resin Download | Caucho
http://caucho.com/products/resin/download/gpl#download

ダウンロードした resin-4.0.43.tar.gz を適当なディレクトリ ( 本エントリーでは /usr/local/resin ) に配置して展開する。

[root@centos62 resin]# pwd
/usr/local/resin
[root@centos62 resin]# ls
resin-4.0.43.tar.gz
[root@centos62 resin]# tar zxvf resin-4.0.43.tar.gz
 ・・・・・

コンパイルする。特に configure のオプションは指定してません。gcc あたりは必要と思います ( なければ yum -y install gcc なりでインストールする )。

[root@centos62 resin]# cd resin-4.0.43
[root@centos62 resin-4.0.43]# ./configure
 ・・・・・
[root@centos62 resin-4.0.43]# make && make install
 ・・・・・
[root@centos62 resin-4.0.43]# ls
LICENSE      automake       configure     init.d    project-jars  win64
Makefile     bin            configure.ac  keys      resin.exe
Makefile.am  compat         contrib       lib       setup.exe
Makefile.in  conf           doc           libtool   webapp-jars
README       config.log     endorsed      licenses  webapps
aclocal.m4   config.status  ext-lib       modules   win32

上記でインストール完了なので、起動してみます。

[root@centos62 resin-4.0.43]# java -jar lib/resin.jar start
Resin/4.0.43 launching watchdog at 127.0.0.1:6600
Resin/4.0.43 started -server 'app-0' with watchdog at 127.0.0.1:6600

もしくは

[root@centos62 resin-4.0.43]# bin/resinctl start
Resin/4.0.43 launching watchdog at 127.0.0.1:6600
Resin/4.0.43 started -server 'app-0' with watchdog at 127.0.0.1:6600

ブラウザから「http://*****:8080」にアクセスすると「Resin® Default Home Page」なページが表示されます。

停止は「java -jar lib/resin.jar stop」、「bin/resinctl stop」で。


2. アプリケーションのデプロイ


デプロイ用ユーザを作成する。

[root@centos62 resin-4.0.43]# java -jar lib/resin.jar generate-password testuser testpass
admin_user : testuser
admin_password : {SSHA}lzBLtCeuanyqEFyIG72ZNXyVW89Y3gc3

上記の出力結果を resin.properties に追記する。あと「remote_admin_enable : true」部分のコメントアウトを外して有効にしておく。

デプロイする .war ファイルを /usr/local/resin/resin-4.0.43 配下に置いて、以下のコマンドを実行する。

[root@centos62 resin-4.0.43]# java -jar lib/resin.jar deploy --user testuser --password testpass Test.war
Deployed production/webapp/default/Test from /usr/local/resin/resin-4.0.43/Test.war to http://127.0.0.1:8080/hmtp

/usr/local/resin/resin-4.0.43/webapps 配下に Test ディレクトリが作成される。


簡単ですが、以上です。

・Resin Installation Quick Start
http://www.caucho.com/resin-4.0/admin/starting-resin.xtp

[ 環境情報 ]
CentOS 6.2
Resin 4.0.43
Java SE 8