Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@ponsuke0531

Port 8686 is not available for the internal rmi registry.となった時の対応方法

  • 環境
    • Red Hat Enterprise Linux Server release 6.3 (Santiago)
    • GlassFish Server Open Source Edition 4.1 (build 13)

GlassFishに繋がらないのでsever.logをみたらなんか言われていた

server.log
[2020-05-29T17:42:42.076+0900] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=65 _ThreadName=Thread-9] [timeMillis: 1590741762076] [levelValue: 1000] [[
  java.lang.RuntimeException: Port 8686 is not available for the internal rmi registry. This means that a call was made with the same port, without closing earlier registry instance. This has to do with the system jmx connector configuration in admin-service element of the configuration associated with this instance
        at org.glassfish.admin.mbeanserver.RMIConnectorStarter._startRegistry(RMIConnectorStarter.java:257)
        at org.glassfish.admin.mbeanserver.RMIConnectorStarter.startRegistry(RMIConnectorStarter.java:235)
        at org.glassfish.admin.mbeanserver.RMIConnectorStarter.<init>(RMIConnectorStarter.java:169)
        at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.startConnector(JMXStartupService.java:310)
        at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.run(JMXStartupService.java:350)]]

原因 : 生き残っている余計なGlassFishがいるから

# ポート8686をGlassFishに設定している
$ grep 8686 /path/to/glassfish4/glassfish/domains/domain1/config/domain.xml
        <jmx-connector port="8686" address="0.0.0.0" auth-realm-name="admin-realm" name="system">

# ポート8686が使われているか見てみる
$ netstat -a -o -n | grep 8686
tcp        0      0 :::8686                     :::*                        LISTEN      off (0.00/0/0)

# GlassFishを停止してみる
$ sudo /etc/init.d/glassfish stop
[sudo] password for ponsuke:
Shutting down glassfish-domain1: Waiting for the domain to stop .
Command stop-domain executed successfully.
                                                           [  OK  ]

# 停止したのにまだ使われている
$ netstat -a -o -n | grep 8686
tcp        0      0 :::8686                     :::*                        LISTEN      off (0.00/0/0)

# ポート8686を使っているプロセスを調べる(sudoしないと他のユーザーのプロセスがみれない)
$ lsof -i:8686
$ sudo lsof -i:8686
[sudo] password for ponsuke:
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    1219 root  406u  IPv6   9990      0t0  TCP *:sun-as-jmxrmi (LISTEN)

# プロセスIDからプロセスを確認するとやっぱり犯人は生き残ったGlassFishだった
$ ps aux | grep 1219
root      1219  4.8  6.5 3675320 489828 ?      Sl   17:41   1:04 /usr/java/default/bin/java -cp /path/to/glassfish4/glassfish/modules/glassfish.jar....

対応 : 生き残っているGlassFishを殺して、generatedディレクトリ配下を削除する

WindowsのEclipseでやった時と同じようなことをする。

  1. 生き残っているGlassFishを殺す
  2. generatedディレクトリ配下を削除する
  3. GlassFishを再起動する
# 生き残っているGlassFishを殺す
$ sudo kill 1219

# generatedディレクトリ配下を削除する
$ sudo rm -rf /path/to/glassfish4/glassfish/domains/domain1/generated/*

# GlassFishを再起動する
$ sudo /etc/init.d/glassfish start
Starting glassfish-domain1: Bad Network Configuration.  DNS can not resolve the hostname:
java.net.UnknownHostException: localhost.localhost: localhost.localhost: ホスト名に対応するアドレスがありません
Waiting for domain1 to start .........................................
Successfully started the domain : domain1
domain  Location: /path/to/glassfish4/glassfish/domains/domain1
Log File: /path/to/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
                                                           [  OK  ]
0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ponsuke0531
びっくりするほど物覚えが悪いが、エンジニアを目指しています。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?