Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8196729

It should be possible to configure jstatd to use fixed RMI port.

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11
    • Fix Version/s: tbd
    • Component/s: core-svc
    • Labels:

      Description

      When running jstatd on remote host behind firewall it should be possible to specify what exact ports needs to be used. Currently jstad provides command line option "-p" to specify RMI registry port but remote objects still communicates over random ports .
      Setting com.sun.management.jmxremote.port and com.sun.management.jmxremote.rmi.portl doesn't work as well.

      Case 1. Both com.sun.management.jmxremote.port and com.sun.management.jmxremote.rmi.port are set. "-p "option is not used.

      Server:
      [opc@serviceability-1 ~]$ /jdk/bin/jstatd -J-Djava.security.policy=java.all.policy -J-Dcom.sun.management.jmxremote.port=9001 -J-Dcom.sun.management.jmxremote.rmi.port=9002 -J-Dcom.sun.management.jmxremote.authenticate=false -J-Dcom.sun.management.jmxremote.local.only=false -J-Dcom.sun.management.jmxremote.ssl=false -J-Djava.rmi.server.hostname=serviceability-1
      jstatd started (bound to /JStatRemoteHost)


      [opc@serviceability-1 ~]$ netstat -anpt
      (Not all processes could be identified, non-owned process info
       will not be shown, you would have to be root to see it all.)
      Active Internet connections (servers and established)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 27046/jstatd
      tcp 0 0 0.0.0.0:9002 0.0.0.0:* LISTEN 27046/jstatd
      tcp 0 0 0.0.0.0:1099 0.0.0.0:* LISTEN 27046/jstatd
      tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
      tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
      tcp 0 0 0.0.0.0:39899 0.0.0.0:* LISTEN 27046/jstatd
      tcp 0 0 10.0.11.4:39899 10.0.11.4:48937 ESTABLISHED 27046/jstatd
      tcp 0 396 10.0.11.4:22 72.197.248.134:58489 ESTABLISHED -
      tcp 0 0 10.0.11.4:44994 10.0.11.4:1099 TIME_WAIT -
      tcp 0 0 10.0.11.4:44997 10.0.11.4:1099 ESTABLISHED 27046/jstatd
      tcp 0 0 10.0.11.4:1099 10.0.11.4:44997 ESTABLISHED 27046/jstatd
      tcp 0 0 10.0.11.4:50225 10.0.11.4:36998 TIME_WAIT -
      tcp 0 0 10.0.11.4:59341 169.254.0.2:3260 ESTABLISHED -
      tcp 0 0 10.0.11.4:48937 10.0.11.4:39899 ESTABLISHED 27046/jstatd
      tcp6 0 0 :::22 :::* LISTEN -

      Client:
      datitov-mac:src datitov$ ~/Java/jdk10/jdk/bin/jps serviceability-1:9001
      RMI Server Not bound: "JStatRemoteHost" (only bound name is "jmxrmi") not available

      datitov-mac:src datitov$ ~/Java/jdk10/jdk/bin/jps serviceability-1:9002
      RMI Registry not available at serviceability-1:9002
      no such object in table

      datitov-mac:src datitov$ ~/Java/jdk10/jdk/bin/jps serviceability-1:1099
      26831 Jstatd


      Case 2. Both com.sun.management.jmxremote.port and com.sun.management.jmxremote.rmi.port are set. "-p "option is set to the same value as specified for com.sun.management.jmxremote.port.

      Server:
      [opc@serviceability-1 ~]$ /jdk/bin/jstatd -J-Djava.security.policy=java.all.policy -J-Dcom.sun.management.jmxremote.port=9001 -J-Dcom.sun.management.jmxremote.rmi.port=9002 -J-Dcom.sun.management.jmxremote.authenticate=false -J-Dcom.sun.management.jmxremote.local.only=false -J-Dcom.sun.management.jmxremote.ssl=false -J-Djava.rmi.server.hostname=serviceability-1 -p 9001
      Could not bind //:9001/JStatRemoteHost to RMI Registry
      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.AccessException: Cannot modify this registry
      at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:391)
      at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
      at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:844)
      at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
      at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
      at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:375)
      at java.rmi/sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:155)
      at java.rmi/java.rmi.Naming.rebind(Naming.java:177)
      at jdk.jstatd/sun.tools.jstatd.Jstatd.bind(Jstatd.java:57)
      at jdk.jstatd/sun.tools.jstatd.Jstatd.main(Jstatd.java:138)
      Caused by: java.rmi.AccessException: Cannot modify this registry
      at jdk.management.agent/sun.management.jmxremote.SingleEntryRegistry.rebind(SingleEntryRegistry.java:81)
      at java.rmi/sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:141)
      at java.rmi/sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:467)
      at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:297)
      at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
      at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:844)

      Case 3. Both com.sun.management.jmxremote.port and com.sun.management.jmxremote.rmi.port are set. "-p "option is set to the same value as specified for com.sun.management.jmxremote.rmi.port .

      [opc@serviceability-1 ~]$ /jdk/bin/jstatd -J-Djava.security.policy=java.all.policy -J-Dcom.sun.management.jmxremote.port=9001 -J-Dcom.sun.management.jmxremote.rmi.port=9002 -J-Dcom.sun.management.jmxremote.authenticate=false -J-Dcom.sun.management.jmxremote.local.only=false -J-Dcom.sun.management.jmxremote.ssl=false -J-Djava.rmi.server.hostname=serviceability-1 -p 9002
      Could not bind //:9002/JStatRemoteHost to RMI Registry
      java.rmi.NoSuchObjectException: no such object in table
      at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
      at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
      at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:375)
      at java.rmi/sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:155)
      at java.rmi/java.rmi.Naming.rebind(Naming.java:177)
      at jdk.jstatd/sun.tools.jstatd.Jstatd.bind(Jstatd.java:57)
      at jdk.jstatd/sun.tools.jstatd.Jstatd.main(Jstatd.java:138)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dtitov Daniil Titov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: