Sun GlassFish Communications Server 2.0 管理ガイド

Windows サービスの作成

Sun GlassFish Communications Server に同梱されている実行可能ファイル appservService.exeappserverAgentService.exe を、Microsoft が提供するサービス制御コマンド (sc.exe) と組み合わせて使用します。

sc.exe コマンドは Windows XP に含まれており、Windows インストールディレクトリの system32 サブディレクトリ (通常は C:\windows\system32C:\winnt\system32 のいずれか) に格納されています。現時点では、Windows 2000 の sc.exeftp://ftp.microsoft.com/reskit/win2000/sc.zip でダウンロードできます。sc.exe の使用方法については、http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndllpro/html/msdn_scmslite.asp を参照してください。

appservService.exeappservAgentService.exe の使用方法は次のとおりです。

C:\winnt\system32\sc.exe create service-name binPath= \"fully-qualified-path-to-appservService.exe 
\"fully-qualified-path-to-asadmin.bat start-command\" 
\"fully-qualified-path-to-asadmin.bat stop-command\"" 
start= auto DisplayName= "display-name"

注 –

binpath と等号 (=) の間にスペースは入れません。等号とパスの間にはスペースが必要です。


たとえば、パスワードファイル C:\Sun\AppServer\password.txt を使ってドメイン domain1 を開始および停止するサービス SunJavaSystemAppServer DOMAIN1 を作成するには、次のようにします。

C:\windows\system32\sc.exe create domain1 binPath= 
"C:\Sun\AppServer\lib\appservService.exe \"C:\Sun\AppServer\bin\asadmin.bat 
start-domain --user admin --passwordfile C:\Sun\AppServer\password.txt domain1\" 
\"C:\Sun\AppServer\bin\asadmin.bat stop-domain domain1\"" start= auto 
DisplayName= "SunJavaSystemAppServer DOMAIN1"

ノードエージェント agent1 を開始および停止するサービスを作成するには、次のようにします。

C:\windows\system32\sc.exe create agent1 binPath= 
"C:\Sun\AppServer\lib\appservAgentService.exe \"C:\Sun\AppServer\bin\asadmin.bat 
start-node-agent --user admin --passwordfile C:\Sun\AppServer\password.txt agent1\" 
\"C:\Sun\AppServer\bin\asadmin.bat stop-node-agent agent1\"" start= auto 
DisplayName= "SunJavaSystemAppServer AGENT1"

注 –

binPath= パラメータの一部として入力された開始コマンドと停止コマンドは、正しい構文で記述されている必要があります。確認するには、それらのコマンドをコマンドプロンプトから実行します。コマンドを実行してもドメインまたはノードエージェントが正常に開始または停止しない場合、そのサービスは正しく動作していません。



注 –

asadminstart/stop コマンドとサービスの開始/停止を混在させないでください。両者を混在させると、サーバーの状態の同期が取れなくなります。たとえば、サーバーのコンポーネントが実行されていないのに「コンポーネントが開始された」と表示されたりします。こうした状況を避けるには、サービス使用時には常に、sc.exe コマンドを使ってコンポーネントを開始および停止するようにしてください。


sc.exe create コマンドでサービスが正しく作成されなかった場合は、そのサービスを削除し、もう一度実行してみてください。サービスを削除するには、sc.exe delete "service-name" コマンドを使用します。