My infrastructure is archived this way (on AWS):
|NAT| <--> |ServerA| <--> |DockerContainer| <--> |GlassFish4.0|
ServerA has a Docker container that works with Glassfish 4.0
ServerA has Internet access through a NAT server.
To connect to ServerA, I connected to SSH on a NAT server, and then SSH on ServerA.
It works smoothly, no problem.
Now I need to connect JConsole on my local machine to the GlassFish server, and here I have problems and you need help.
I added the following JVM parameters to the domain.xml file:
<jvm-options>-Dsun.management.jmxremote.level=FINEST</jvm-options>
<jvm-options>-Dsun.management.jmxremote.handlers=java.util.logging.ConsoleHandler</jvm-options>
<jvm-options>-Djava.util.logging.ConsoleHandler.level=FINEST</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.port=9010</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.rmi.port=9010</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.host=0.0.0.0</jvm-options>
<jvm-options>-Djava.rmi.server.hostname=10.0.0.115</jvm-options>
Where 10.0.0.115 (for java.rmi.server.hostname) is the local address of ServerA.
Then I create an SSH tunnel from the local machine to the NAT server as follows:
ssh -L 9010:localhost:9010 nat
And then I make another SSH tunnel for ServerA as follows:
ssh -L 9010:localhost:9010 serverA
9010 , :
docker run --restart=always --name $CONTAINER_NAME \
-d \
-p 4848:4848 \
-p 8080:8080 \
-p 9010:9010 \
my container
, JConsole, localhost:9010, .
localhost 9010 :
telnet localhost 9010
Trying ::1...
Connected to localhost.
Escape character is '^]'.
^C^C^C^C^C^C
^]
::
exit
^Z^Z^X^C^V^M
Connection closed by foreign host.
Connection closed by foreign host.
VisualJM, localhost: 9010 VisualJM , "" localhost , JMX.
NAT ServerA IP-, , , .
- , ?
EDIT:
jconsole -debug , JVM , :
java.lang.SecurityException: Expecting a javax.rmi.ssl.SslRMIClientSocketFactory RMI client socket factory in stub!
at javax.management.remote.rmi.RMIConnector.checkStub(RMIConnector.java:1903)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:295)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:355)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:313)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:294)
2
netstat ServerA :
netstat -a | grep 9010
tcp 0 0 ip-XXX-XX-XX-X.us:34406 ip-XXX-XX-Y-YYY.us:9010 ESTABLISHED
tcp 0 0 localhost:54745 localhost:9010 ESTABLISHED
tcp6 0 0 [::]:9010 [::]:* LISTEN
tcp6 0 0 localhost:9010 localhost:54745 ESTABLISHED
X - , Y -