Webアプリ本番環境の構築 <Java, GlassFish, MySQL>
『[1] Webアプリ開発環境の構築 <Java, GlassFish, MySQL, NetBeans>』 の手順でNetBeans以外をインストール・設定する。
※WindowsXPなら「.NET Framework 3.5」もインストールしておく。 http://www.microsoft.com/ja-jp/download/details.aspx?id=22
マシン起動時にGlassFishも起動するようWindowsサービスに登録するために、 コマンドプロンプトを管理者として起動して下記の要領で入力していく。
※C:\glassfish4\binに移動する。 C:\Windows\system32>cd C:\glassfish4\bin ※GlassFishが起動中だったら困るので停止コマンドを実行する。 C:\glassfish4\bin>asadmin.bat stop-domain domain1 Waiting for the domain to stop ..... Command stop-domain executed successfully. ※起動中でない場合は下記のようなメッセージが表示される。 CLI306: Warning - The server located at C:\glassfish4\glassfish\domains\domain1 is not running. Command stop-domain executed successfully. ※Windowsサービスに登録する。 C:\glassfish4\bin>asadmin.bat create-service domain1 The Windows Service was created successfully. It is ready to be started. Here are the details: ID of the service: domain1 Display Name of the service:domain1 GlassFish Server Server Directory: C:\glassfish4\glassfish\domains\domain1 Configuration file for Windows Services Wrapper: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.xml The service can be controlled using the Windows Services Manager or you can use the Windows Services Wrapper instead: Start Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe start Stop Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe stop Restart Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe restart Uninstall Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe uninstall Install Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe install Status Command: C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe status You can also verify that the service is installed (or not) with sc query state= all windows.services.uninstall.good=Found the Windows Service and successfully uninstalled it. For your convenience this message has also been saved to this file: C:\glassfish4\glassfish\domains\domain1\PlatformServices.log Command create-service executed successfully. ※サービスを開始する。 C:\glassfish4\bin>C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe start ※サービスの状態を確認する。 C:\glassfish4\bin>C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe status Started ※管理者のパスワードを変更する。 C:\glassfish4\bin>asadmin.bat change-admin-password Enter admin user name [default: admin]> Enter the admin password> Enter the new admin password> Enter the new admin password again> Command change-admin-password executed successfully. ※リモートから管理コンソール(https://<サーバのipアドレス>:4848/)にアクセスできるようにする。 C:\glassfish4\bin>asadmin.bat enable-secure-admin Authentication failed with password from login store: C:\Documents and Settings\Administrator\.gfclient\pass Enter admin password for user "admin"> You must restart all running servers for the change in secure admin to take effect. Command enable-secure-admin executed successfully. ※サービスを再起動する。 C:\glassfish4\bin>C:\glassfish4\glassfish\domains\domain1\bin\domain1Service.exe restart C:\glassfish4\bin>