Windows上でGlassfishを起動しようとしたときの「Remote server does not listen for requests on [localhost:4848]. Is the server up?」エラーについて

Windows上でGlassfishを起動しようとして悩んだところがあったので備忘録として残そうと思う。

 

Glassfishを停止して、また起動をしようとすると下記のエラーがでた。

D:\GlassFish\glassfish4\glassfish\bin>asadmin start-domains webapp_domain
Remote server does not listen for requests on [localhost:4848]. Is the server up?
Unable to get remote commands.
Closest matching local command(s):
start-domain

Command start-domains failed.

 

「サーバー起動してませんか?」みたいに聞かれるが、jvmのプロセスも4848ポートにバインドしているプロセスもないのでなんでかなぁ?と調べてるみると、ドメインディレクトリ(デフォルトではdomain1が既にあるはず)の下のosgi-cacheが原因らしく、そのディレクトリを削除してあげたら正常に起動できた。

├─applications
├─autodeploy
├─bin
├─config
├─docroot
├─generated
├─init-info
├─lib

├─logs
└─osgi-cache

 

osgi-cacheディレクトリを削除して再度実行するとうまくいった。

 

D:\GlassFish\glassfish4\glassfish\bin>asadmin start-domain webapp_domain
Waiting for webapp_domain to start ............................
Successfully started the domain : webapp_domain
domain  Location: D:\GlassFish\glassfish4\glassfish\domains\webapp_domain
Log File: D:\GlassFish\glassfish4\glassfish\domains\webapp_domain\logs\server.log
Admin Port: 58531
Command start-domain executed successfully.

 

ただ上記の例は、自作したwebapp_domainを動かそうとして、デフォルトであるdomain1ディレクトリ配下のosgi-cacheを消した形になる。

osgi-cacheディレクトリはドメイン作成時には存在していないが、サーバーを起動した際に作成される。配下にはbundleXXXディレクトリ(XXXは連番)が作成され続ける模様。

正直まだosgi-cacheディレクトリについては何も分かってない状態なので勉強が必要かな。