GlassFish v2.1の起動時にCannot bind to URL

感想おまちしてます!

GlassFishを起動しなおすと以下のエラーが出た。

 [#|2009-03-15T13:59:00.559+0900|SEVERE|sun-appserver2.1|javax.enterprise.system.core|_ThreadID=10;_ThreadName=main;com.sun.enterprise.admin.server.core.JmxConnectorLifecycle@5a25f3;com.sun.appserv.server.ServerLifecycleException: Cannot bind to URL [rmi://192.168.0.2:8686/management/rmi-jmx-connector]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect];_RequestID=281d7895-15b0-44de-b300-552afc58918b;|Service com.sun.enterprise.admin.server.core.JmxConnectorLifecycle@5a25f3 cannot be started! : com.sun.appserv.server.ServerLifecycleException: Cannot bind to URL [rmi://192.168.0.2:8686/management/rmi-jmx-connector]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect]|#]
[#|2009-03-15T13:59:00.559+0900|SEVERE|sun-appserver2.1|javax.enterprise.system.core|_ThreadID=10;_ThreadName=main;_RequestID=281d7895-15b0-44de-b300-552afc58918b;|CORE5071: 初期化中にエラーが発生しました
com.sun.appserv.server.ServerLifecycleException: Cannot bind to URL [rmi://192.168.0.2:8686/management/rmi-jmx-connector]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect]
at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:153)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:446)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
Caused by: java.io.IOException: Cannot bind to URL [rmi://192.168.0.2:8686/management/rmi-jmx-connector]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:804)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:417)
at com.sun.enterprise.admin.jmx.remote.server.rmi.JmxConnectorServerDriver.startConnectorServer(JmxConnectorServerDriver.java:240)
at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:134)
... 9 more
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect]
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:126)
at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:625)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:412)
... 11 more
Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.0.2; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:120)
... 15 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.(Socket.java:366)
at java.net.Socket.(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 20 more
|#]

192.168.0.2はローカルのIPなので、JMXかなんかのバインドができていないぽい。
Lanケーブルを抜いてファイアウォールを落とすとうまくいったので、設定で何とかできそうなんだけどRMIのプロトコル番号がわからない・・・。

調べてみると、以下のページを発見。

  • GlassFish -> Cannot bind to URL [rmi://82.139.34.57:8686/management/rmi-jmx-connector]:
  • OSX Leopard + Glassfish Read This
  • C:\fujihara\glassfish-v21\domains\domain1\config\domain.xmlを修正したら起動できた。

     修正前。

     <jmx-connector accept-all="false" address="localhost" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">

    enabledがtrueになっているので、falseにする。

     修正後。

     <jmx-connector accept-all="false" address="localhost" auth-realm-name="admin-realm" enabled="false" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">

    GlassFishの管理コンソールの設定>管理サービス>SystemのJMXの設定で有効チェックボックスを外した状態になる。
    これだとjconsoleでつなげれないので、Serverを落とすときはFalseにするしかないなー。