2015-03-13 67 views
2

我在碼頭集裝箱遠程計算機上運行tomcat。現在我想使用VisualVM進行連接。我的搬運工啓動命令:VisualVM無法連接遠程tomcat在碼頭與RMI

docker run -d --name tomcat -p 26000:8080 -p 9090:9090 -p 9091:9091 -v /data/docker/tomcat/webapps:/data/tomcat/webapps -v /data/docker/tomcat/logs:/data/tomcat/logs -e CATALINA_OPTS="-Xms2048M -Xmx2048M -XX:MaxPermSize=256M -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1" my.private.hub/tomcat:latest 

而且catalina.log:

13-Mar-2015 10:29:56.615 INFO [Thread-10] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-8080"] 
13-Mar-2015 10:29:56.666 INFO [Thread-10] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"] 
13-Mar-2015 10:29:56.718 INFO [Thread-10] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"] 
13-Mar-2015 10:29:56.718 INFO [Thread-10] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"] 
13-Mar-2015 10:31:01.787 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:  Apache Tomcat/8.0.20 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:   Feb 15 2015 18:10:42 UTC 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:   8.0.20.0 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:    Linux 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:   3.13.0-40-generic 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:   amd64 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:    /usr/lib/jvm/java-7-oracle/jre 
13-Mar-2015 10:31:01.789 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:   1.7.0_76-b13 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:   Oracle Corporation 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:   /data/tomcat 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:   /data/tomcat 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/data/tomcat/conf/logging.properties 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
13-Mar-2015 10:31:01.790 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms2048M 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx2048M 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=256M 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=true 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=9090 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/data/tomcat/endorsed 
13-Mar-2015 10:31:01.791 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/data/tomcat 
13-Mar-2015 10:31:01.792 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/data/tomcat 
13-Mar-2015 10:31:01.792 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/data/tomcat/temp 
13-Mar-2015 10:31:01.792 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1. 

但VisuamVM無法連接:

'Cannot connect using service:jmx:rmi:///jndi/rmi://192.168.0.119:9090/jmxrmi' 

其中192.168.0.119是遠程主機的地址機。

回答

0

-Djava.rmi.server.hostname = 127.0.0.1

應使用您用於連接到它

你的搬運工主機IP -Djava.rmi.server.hostname = 192.168.0.119